【问题标题】:Can You Make A Small Adjustment To A Style Based On Another Style In XAML能否根据 XAML 中的另一种样式对样式进行小幅调整
【发布时间】: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 属性。

标签: wpf xaml styles


【解决方案1】:

不,这是不可能的。再次设置时必须完全替换Margin。

【讨论】:

    猜你喜欢
    • 2010-10-22
    • 2016-04-25
    • 1970-01-01
    • 2016-06-01
    • 2013-08-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多