zoukankan      html  css  js  c++  java
  • 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

  • 相关阅读:
    Redis 优化之 tcp-backlog
    linux下生成带符号的随机密码
    mysqldump导出sql文件中insert多行问题
    /usr/lib64/python2.6/site-packages/cryptography/__init__.py:26: DeprecationWarning: Python 2.6 is no longer supported by the Python core team
    ldconfig: /usr/lib/libpython2.6.so.1.0-gdb.py is not an ELF file
    [Errno 14] problem making ssl connection Trying other mirror.
    docker commit 显示“invalid reference format”
    (转)从Python的0.1输出0.1000000000000001说浮点数的二进制
    mysql中replicate_wild_do_table和replicate_do_db区别
    ipsec验证xl2tpd报错:handle_packet: bad control packet!
  • 原文地址:https://www.cnblogs.com/-ShiL/p/Star201310220236.html
Copyright © 2011-2022 走看看