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>
  • 相关阅读:
    高性能计算发展简史
    软件里有“slave”关键字算不算种族歧视
    LAXCUS集群的松耦合和紧耦合性能对比
    《操作系统》课程笔记(Ch12-大容量存储结构)
    《剑指Offer》部分简单题题解
    ASP.Net Core 5.0 MVC中AOP思想的体现(五种过滤器)并结合项目案例说明过滤器的用法
    扒一扒 剪视频-致力打造最好用的视频创作导航
    C#设计模式02——原型模式的写法
    C#设计模式03——简单工厂的写法
    C#设计模式04——工厂方法的写法
  • 原文地址:https://www.cnblogs.com/star250/p/2013477.html
Copyright © 2011-2022 走看看