【发布时间】:2011-06-20 19:38:01
【问题描述】:
是否可以根据XAML中的其他样式对样式进行小幅调整,我想做这样的事情:
<Style TargetType="{x:PseudoType MostControls}" x:Key="WhatMostControlsLookLike">
<Setter Property="Margin" Value="10" />
</Style>
<Style TargetType="{x:PseudoType ThisControl}"
x:Key="WhatThisControlLooksLike"
BasedOn={StaticResource WhatMostControlsLookLike}">
<Setter Property="Margin">
<Setter.Value>
<!-- Top, Right, and Bottom are 10 as per WhatMostControlsLookLike-->
<Thickness>
<!-- But Left is 10 times as thick-->
<Thickness.Left>100</Thickness.Left>
</Thickness>
</Setter.Value>
</Setter>
</Style>
【问题讨论】:
-
这样,您重新定义了 Margin 属性。