如何在 App.xaml 中为 CustomButton 定义样式?
应用程序.xaml
<Style x:Key="CustomButtonSmall" TargetType="CustomButton">
<Setter Property="FontSize" Value="14" />
</Style>
我的页面.xaml
<local:CustomButton Text="{i18n:Translate CreateAccountButton}"
Grid.Column="0" Command="{Binding CreateAccountCommand}"
Type="Normal" Style="{StaticResource CustomButtonSmall}" />
在 App.xaml 中
给 CustomButton 整个路径,如 TargetType="Control:CustomButton" 并在顶部定义 Control
xmlns:Control="clr-namespace:xyz"
<Style x:Key="CustomButtonSmall" TargetType="Control:CustomButton">
<Setter Property="FontSize" Value="14" />
</Style>
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句