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>
  • 相关阅读:
    华为路由器配置 FTP
    交换机远程 Telnet设置
    动态路由协议 OSPF
    动态路由协议 RIP
    Fiddler 为手机设置代理上网
    路由优先级、路由链路冗余
    关闭137,138,139危险端口
    VNC远程连接一直在Attempting to reconnect to VNC server...
    ManageEngine卓豪旗下Site24x7云监控2020年"成绩单"
    实现无缝的终端安全的5大模块
  • 原文地址:https://www.cnblogs.com/cloudbeer/p/1519336.html
Copyright © 2011-2022 走看看