您始终可以为
Button
定义自定义模板,例如:
<customcontrols:CustomDatePicker x:Name="DataCreazione"
SelectedDate="{Binding DataCreazione, StringFormat={}{0:dd/MM/yyyy}}"
controls:TextBoxHelper.Watermark="Data Creazione"
Cursor="Hand"
BorderThickness="0"
SelectedDateFormat="Short"
Margin="0,0,0,0"
Grid.ColumnSpan="3"
Grid.Row="1" >
<customcontrols:CustomDatePicker.Resources>
<ControlTemplate x:Key="ButtonTemplate" TargetType="Button">
<Grid Background="Silver">
<iconPacks:PackIconControl Kind="{x:Static iconPacks:PackIconFontAwesomeKind.CalendarAltSolid}"
Width="24"
Height="24" />
</Grid>
</ControlTemplate>
</customcontrols:CustomDatePicker.Resources>
</customcontrols:CustomDatePicker>
if (Template.FindName("PART_Button", this) is Button button)
{
button.Template = FindResource("ButtonTemplate") as ControlTemplate;
}