zoukankan      html  css  js  c++  java
  • 学习WPF里的ListBox控件的Triggers

    <ControlTemplate.Triggers>
                                
    <Trigger Property="IsSelected" Value="true"<!-- 当Item选中时 -->
                                    <Setter Property="Background" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"/> <!-- x:Name="Bd"的控件的背景 设置为系统颜色 -->
                                    <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.HighlightTextBrushKey}}"/> <!-- 字体颜色 -->
                                    <Setter Property="Fill" TargetName="PathSelected" Value="Red"></Setter<!-- x:Name="PathSelected" 路径的填充颜色为红色 -->
                                    <Setter Property="Visibility" TargetName="PathSelected" Value="Visible"/> <!-- x:Name="PathSelected" 显示 -->
                                </Trigger>
                                
    <MultiTrigger>  <!-- 此为组合条件 -->
                                    <MultiTrigger.Conditions>
                                        
    <Condition Property="IsSelected" Value="true"/> <!-- 条件一 选中 -->
                                        <Condition Property="Selector.IsSelectionActive" Value="false"/> <!-- 条件二 我理解为失去焦点 -->
                                    </MultiTrigger.Conditions>
                                    
                                    
    <Setter Property="Background" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
                                    
    <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
                            
                                
                                
    </MultiTrigger>
                                
    <Trigger Property="IsEnabled" Value="false">
                                    
    <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
                                
    </Trigger>
                            
    </ControlTemplate.Triggers>
                        
    </ControlTemplate>
  • 相关阅读:
    魔法方法中的__str__和__repr__区别
    新建分类目录后,点击显示错误页面?
    3.用while和for循环分别计算100以内奇数和偶数的和,并输出。
    2.for循环实现打印1到10
    1.while循环实现打印1到10
    021_for语句
    014_运算符_字符串连接
    020_while语句
    019_增强switch语句
    018_switch语句
  • 原文地址:https://www.cnblogs.com/star250/p/2013477.html
Copyright © 2011-2022 走看看