• Button Style Status


     1 <Window x:Class="Dxsl.WPF.APP.Views.StyleTest2"
     2         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
     3         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
     4         Title="StyleTest2" Height="300" Width="300">
     5 
     6     <Grid >
     7         <Grid.Resources>
     8             <Style x:Key="ZoomInButton" BasedOn="{x:Null}" TargetType="{x:Type Button}">
     9                 <Setter Property="Width" Value="16" />
    10                 <Setter Property="Height" Value="16" />
    11                 <Setter Property="Template">
    12                     <Setter.Value>
    13                         <ControlTemplate TargetType="{x:Type Button}">
    14                             <Grid>
    15                                 <Ellipse x:Name="Shadow" Fill="#FF000000" Margin="1,1,-1,-1" Opacity="0.05" />
    16                                 <Grid x:Name="DefaultState">
    17                                     <Border Background="Red" Padding="1" CornerRadius="64">
    18                                         <TextBlock Text="Red" />
    19                                     </Border>
    20                                 </Grid>
    21                                 <Grid x:Name="HoverState" Opacity="0">
    22                                     <Border Background="Yellow" Padding="1" CornerRadius="64">
    23                                         <TextBlock Text="Yellow" />
    24                                     </Border>
    25                                 </Grid>
    26                                 <Grid x:Name="PressedState" Opacity="0">
    27                                     <Border Background="Green" Padding="1" CornerRadius="64">
    28                                         <TextBlock Text="Green" />
    29                                     </Border>
    30                                 </Grid>
    31                                 <Grid x:Name="DisabledState" Opacity="0">
    32                                     <Border Background="Black" Padding="1" CornerRadius="64">
    33                                         <TextBlock Text="Black" />
    34                                     </Border>
    35                                 </Grid>
    36                                 <Path x:Name="Glyph" Stretch="Fill" Fill="#FF6D7484" Data="F1 M 568,189L 570,189L 570,191L 572,191L 572,193L 570,193L 570,195L 568,195L 568,193L 566,193L 566,191L 568,191L 568,189 Z " Width="6" Height="6" HorizontalAlignment="Center" VerticalAlignment="Center" />
    37                                 <VisualStateManager.VisualStateGroups>
    38                                     <VisualStateGroup x:Name="CommonStates">
    39                                         <VisualState x:Name="Normal">
    40                                             <Storyboard>
    41                                                 <DoubleAnimation Storyboard.TargetName="DefaultState" Storyboard.TargetProperty="Opacity" Duration="0" To="1" />
    42                                             </Storyboard>
    43                                         </VisualState>
    44                                         <VisualState x:Name="MouseOver">
    45                                             <Storyboard>
    46                                                 <DoubleAnimation Storyboard.TargetName="HoverState" Storyboard.TargetProperty="Opacity" Duration="0" To="1" />
    47                                                 <ColorAnimation Storyboard.TargetName="Glyph" Storyboard.TargetProperty="(Rectangle.Fill).(SolidColorBrush.Color)" Duration="0" To="#FF1B293E" />
    48                                             </Storyboard>
    49                                         </VisualState>
    50                                         <VisualState x:Name="Pressed">
    51                                             <Storyboard>
    52                                                 <DoubleAnimation Storyboard.TargetName="PressedState" Storyboard.TargetProperty="Opacity" Duration="0" To="1" />
    53                                                 <ColorAnimation Storyboard.TargetName="Glyph" Storyboard.TargetProperty="(Rectangle.Fill).(SolidColorBrush.Color)" Duration="0" To="#FF1B293E" />
    54                                             </Storyboard>
    55                                         </VisualState>
    56                                         <VisualState x:Name="Disabled">
    57                                             <Storyboard>
    58                                                 <DoubleAnimation Storyboard.TargetName="DisabledState" Storyboard.TargetProperty="Opacity" Duration="0" To="1" />
    59                                             </Storyboard>
    60                                         </VisualState>
    61                                     </VisualStateGroup>
    62                                 </VisualStateManager.VisualStateGroups>
    63                             </Grid>
    64                         </ControlTemplate>
    65                     </Setter.Value>
    66                 </Setter>
    67             </Style>
    68         </Grid.Resources>
    69 
    70         <DockPanel HorizontalAlignment="Center" VerticalAlignment="Center">
    71             <Slider Visibility="Collapsed" Name="Slider" Minimum="0.2" Maximum="2" />
    72             <Button DockPanel.Dock="Left" Width="200" Height="200" Click="Button_Click" Style="{DynamicResource ZoomInButton}"  Content="-" />
    73             <Button DockPanel.Dock="Right" Click="Button_Click" Style="{DynamicResource ZoomInButton}"   Content="+" />
    74 
    75         </DockPanel>
    76     </Grid>
    77 </Window>
    Button Style

  • 相关阅读:
    chrome 等浏览器不支持本地ajax请求的问题
    3:1 类型转换
    WebService-WSDL简单介绍
    WebService—CXF整合Spring实现接口发布和调用过程
    WebService—CXF—实现接口发布和客户端调用
    WebService—规范介绍和几种实现WebService的框架介绍
    (转)c# 扩展方法
    (转)C# Textbox的ImeMode取值对中文输入法的影响
    (转)Nandflash读写
    (转+整理)Nandflash存储
  • 原文地址:https://www.cnblogs.com/-ShiL/p/Star201310220236.html
Copyright © 2020-2023  润新知