在WPF中,我使用以下代码覆盖基本控件样式:
<Style TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Type Button}}">
<Setter Property="Padding" Value="5" />
<Setter Property="Margin" Value="{StaticResource margin}" />
</Style>
Run Code Online (Sandbox Code Playgroud)
在UWP中x:Type,XAMl已经消失了.那么如何在UWP中完成上述代码呢?谢谢.
从我可以从收集资料,x:Type在通用的Windows应用程序不再支持.
要绕过样式继承,您需要创建一个具有的基本样式x:Key,可以使用StaticResource该BasedOn属性的标记来引用它.
<Style x:Key="BasicButtonStyle" TargetType="Button">
... (This may contain nothing)
</Style>
<Style TargetType="Button"
BasedOn="{StaticResource BasicButtonStyle}">
...
</Style>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2728 次 |
| 最近记录: |