zoukankan      html  css  js  c++  java
  • 将toolbar 按钮中的图片弄成灰色的

    当然是要随着 CommandBinding 的 Command 一起联动了。

    这么做的:

    搞一个 Style,在里面搞个触发器,触发器的两边分别是:包含图片的button的IsEnabled属性 和 False,当button不可用的时候,就把图片的 透明度弄低。

            <ToolBar Name="toolBarPanel1" VerticalAlignment="Top" Height="76" Margin="0,24,0,0" Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="3">            
                
    <ToolBar.Resources>
                    
    <Style TargetType="{x:Type Image}" x:Key="toolbarImageStyle">
                        
    <Style.Triggers>
                            
    <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type Button}, AncestorLevel=1}, Path=IsEnabled}" Value="False">
                                
    <Setter Property="Opacity" Value="0.20"></Setter>
                            
    </DataTrigger>
                        
    </Style.Triggers>
                    
    </Style>
                
    </ToolBar.Resources>
                
    <Button Height="70" HorizontalAlignment="Left" Name="btnOpenFile" VerticalAlignment="Top" Width="70" Command="ApplicationCommands.Open" ToolTip="打开项目">
                   
    <Image  Source="/ZippyWPFForm;component/icons/open.png" HorizontalAlignment="Left" Style="{StaticResource toolbarImageStyle}"></Image>
                
    </Button>
            
    </ToolBar>
  • 相关阅读:
    STP-5-STP配置及分析
    PostgreSQL-10-数据运算与函数
    PostgreSQL-9-别名与动态表复制
    PostgreSQL-8-数据合并
    PostgreSQL-7-数据连接
    PostgreSQL-6-数据分组
    STP-4-每VLAN生成树和Trunk上的STP
    VLAN-6-VLAN Trunk协议(VTP)
    STP-3-收敛到新的STP拓扑
    STP-2-三个选择
  • 原文地址:https://www.cnblogs.com/cloudbeer/p/1519336.html
Copyright © 2011-2022 走看看