【发布时间】:2012-05-26 07:15:10
【问题描述】:
我定义了两种简单的边距样式,一种基于另一种。
<Style x:Key="marginStyle" TargetType="FrameworkElement">
<Setter Property="Margin" Value="0,10,20,10"/>
</Style>
<!-- based on marginStyle -->
<Style x:Key="marginIndentStyle" TargetType="FrameworkElement" BasedOn="{StaticResource marginStyle}">
<Setter Property="Margin" Value="10,0,0,0"/>
</Style>
在派生的 'marginIndentStyle' 样式中,我想将边距的 Left 属性调整为比基础 'marginStyle' 样式中的 Left 属性多 10,即比当前设置的值多 10。使用上面的类似内容会完全覆盖这些值。我只想添加到它,使得派生的“marginIndentStyle”样式的结果边距是“10,10,20,10”。
注意,我不想将其值严格设置为 10、10、20、10 b/c,我希望“marginStyle”样式的任何更改都反映在派生的“marginIndentStyle”样式中。
这可能吗?
【问题讨论】: