你可以根据XAML中的另一种风格对一种风格进行小调整

时间:2011-06-20 19:38:01

标签: wpf xaml styles

是否可以根据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>

1 个答案:

答案 0 :(得分:0)

不,那是不可能的。重新设置时必须完全替换边距。