How do wpf control template triggers work?

删除回忆录丶 提交于 2019-12-13 06:39:27

问题


I have seen a control template for tab control...in 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 ?
<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>

回答1:


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)



来源:https://stackoverflow.com/questions/7341711/how-do-wpf-control-template-triggers-work

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!