简体   繁体   English

WPF控制模板触发器如何工作?

[英]How do wpf control template triggers work?

I have seen a control template for tab control...in http://www.codeproject.com/KB/WPF/WPFOutlookNavi.aspx 我在http://www.codeproject.com/KB/WPF/WPFOutlookNavi.aspx中看到了用于标签控件的控件模板

  1. Is this property triggers ? 该属性会触发吗? (Not data/event triggers) (不是数据/事件触发器)
  2. Is this trigger works this way - if TabStripPlacement is "Bottom"...all Setters will be executed ? 此触发器是否以这种方式工作-如果TabStripPlacement为“ Bottom” ...则将执行所有设置器?
<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>

Yes and yes, except that "executed" may be the wrong word here, more accurate would be: While TabStrinpPlacement is Bottom, the setters are active. 是的,是的,除了“ execute”在这里可能是错误的词外,更准确的是:当TabStrinpPlacement为Bottom时,设置器处于活动状态。 (ie if the value changes to something else the previous values will be used again, see also: DP Precedence ) (即,如果该值更改为其他值,则将再次使用之前的值,另请参见: DP优先级

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM