zoukankan      html  css  js  c++  java
  • WPF样式——多条件触发器

    希望创建多个条件都为真时才激发的触发器,就需要使用MultiTrigger提供的Condition集合

     1 <Window x:Class="Styles.MultiTrigger"
     2         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
     3         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
     4         Title="MultiTrigger" Height="300" Width="300">
     5     <Window.Resources>
     6         <Style x:Key="BigFontButton">
     7             <Style.Setters>
     8                 <Setter Property="Control.FontFamily"
     9                         Value="Times New Roman" />
    10                 <Setter Property="Control.FontSize"
    11                         Value="18" />
    12 
    13             </Style.Setters>
    14             <Style.Triggers>
    15                 <MultiTrigger>
    16                     <MultiTrigger.Conditions>
    17 
    18                         <Condition Property="Control.IsFocused"
    19                                    Value="True"></Condition>
    20 
    21                         <Condition Property="Control.IsMouseOver"
    22                                    Value="True"></Condition>
    23                     </MultiTrigger.Conditions>
    24                     <MultiTrigger.Setters>
    25                         <Setter Property="Control.Foreground" Value="DarkRed"></Setter>
    26                     </MultiTrigger.Setters>
    27                 </MultiTrigger>
    28             </Style.Triggers>
    29         </Style>
    30     </Window.Resources>
    31 
    32     <StackPanel Margin="5">
    33         <Button Padding="5"
    34                 Margin="5"
    35                 Style="{StaticResource BigFontButton}">A Customized Button</Button>
    36         <TextBlock Margin="5">Normal Content.</TextBlock>
    37         <Button Padding="5"
    38                 Margin="5">A Normal Button</Button>
    39         <TextBlock Margin="5">More normal Content.</TextBlock>
    40         <Button Padding="5"
    41                 Margin="5"
    42                 Style="{StaticResource BigFontButton}">Another Customized Button</Button>
    43     </StackPanel>
    44 </Window>
  • 相关阅读:
    poj 3122 Pie (二分)
    poj 1905 Expanding Rods(二分)
    poj 3258 River Hopscotch (二分)
    poj 3273 Monthly Expense(二分穷举)
    最小最大堆
    最小—最大堆
    zend studio 9 字体,颜色,快捷键等相关设置
    javascript onbeforeunload
    php DOMDocument 不能解析引用外部DTD的XML
    phpdoc 注释关键字含义
  • 原文地址:https://www.cnblogs.com/zuifengke/p/3753519.html
Copyright © 2011-2022 走看看