码迷,mamicode.com
首页 > Windows程序 > 详细

wpf image button样式

时间:2017-07-19 19:32:17      阅读:339      评论:0      收藏:0      [点我收藏+]

标签:resource   width   height   and   程序   component   smo   over   image   

1:image button样式

<Style x:Key="Button.File" TargetType="Button">
  <Setter Property="Cursor" Value="Hand"></Setter>
  <Setter Property="Template" >
    <Setter.Value>
      <ControlTemplate TargetType="Button">
        <Image Name="FileImage" Source="/程序集名称;component/images/file.png"/>
        <ControlTemplate.Triggers>
          <Trigger Property="IsMouseOver" Value="True">
            <Setter TargetName="FileImage" Property="Source" Value="/程序集名称;component/images/file_over.png"/>
          </Trigger>
        </ControlTemplate.Triggers>
      </ControlTemplate>
    </Setter.Value>
  </Setter>
</Style>

2:使用image button样式

<Button Style="{StaticResource Button.File}" Height="30" Width="30" VerticalAlignment="Center" HorizontalAlignment="Center"></Button>

wpf image button样式

标签:resource   width   height   and   程序   component   smo   over   image   

原文地址:http://www.cnblogs.com/by-lhc/p/7207306.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!