WPF控制模板触发器如何工作? [英] How do wpf control template triggers work?

查看:119
本文介绍了WPF控制模板触发器如何工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 http://www中看到了选项卡控件的控件模板... .codeproject.com/KB/WPF/WPFOutlookNavi.aspx

  1. 此属性是否触发? (不是数据/事件触发器)
  2. 此触发器是否以此方式工作-如果TabStripPlacement为"Bottom" ...则将执行所有的Setter吗?

<ControlTemplate.Triggers>
    <Trigger Property="TabStripPlacement" Value="Bottom">
        <Setter Property="Grid.Row" TargetName="ContentPanel" Value="0" />
        <Setter Property="Height" TargetName="RowDefinition0" Value="*" />
        <Setter Property="Height" TargetName="RowDefinition1" Value="Auto" />
    </Trigger>
    <Trigger Property="IsEnabled" Value="false">
        <Setter Property="Foreground" Value="{DynamicResource
            {x:Static SystemColors.GrayTextBrushKey}}" />
    </Trigger>
</ControlTemplate.Triggers>

推荐答案

是的,是的,除了"execute"可能是错误的单词,更准确的是:尽管TabStrinpPlacement为Bottom,但设置器是活动的. (即,如果该值更改为其他值,则将再次使用以前的值,另请参见:

Yes and yes, except that "executed" may be the wrong word here, more accurate would be: While TabStrinpPlacement is Bottom, the setters are active. (i.e. if the value changes to something else the previous values will be used again, see also: DP Precedence)

这篇关于WPF控制模板触发器如何工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆