• WPF个性选择框


    样式代码:

    <Style x:Key="CheckBoxStyle" TargetType="{x:Type CheckBox}">
                <Setter Property="Background" Value="#FF26405B"/>
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type CheckBox}">
                            <Grid Background="Transparent">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition  Width="auto"/>
                                    <ColumnDefinition/>
                                </Grid.ColumnDefinitions>
                                <Viewbox Width="{TemplateBinding Height}" Height="{TemplateBinding Height}">
                                    <Grid>
                                        <Path Data="M1.5,16 C1.5,7.9918711 7.9918711,1.5 16,1.5 L69,1.5 C77.008129,1.5 83.5,7.9918711 83.5,16 L83.5,69 C83.5,77.008129 77.008129,83.5 69,83.5 L16,83.5 C7.9918711,83.5 1.5,77.008129 1.5,69 z"  Height="85"  Stretch="Fill" Stroke="{TemplateBinding Background}" StrokeThickness="3" Width="85"/>
                                        <Path x:Name="path" Data="M210,180 L239.5,199.5 269.5,154.5 234.5,184.5 z" Fill="{TemplateBinding Background}"  Height="46"  Stretch="Fill"  Width="60.5" RenderTransformOrigin="0.5,0.5">
                                            <Path.RenderTransform>
                                                <TransformGroup>
                                                    <ScaleTransform ScaleX="0" ScaleY="0"/>
                                                    <SkewTransform/>
                                                    <RotateTransform/>
                                                    <TranslateTransform/>
                                                </TransformGroup>
                                            </Path.RenderTransform>
                                        </Path>
                                    </Grid>
                                </Viewbox>
                                <ContentPresenter Grid.Column="1" Margin="5 0 0 0" HorizontalAlignment="Left" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="Center"/>
                            </Grid>
                            <ControlTemplate.Triggers>
                                <Trigger Property="IsChecked" Value="True">
                                    <Trigger.ExitActions>
                                        <BeginStoryboard >
                                            <Storyboard >
                                                <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)" Storyboard.TargetName="path">
                                                    <EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="0"/>
                                                </DoubleAnimationUsingKeyFrames>
                                                <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)" Storyboard.TargetName="path">
                                                    <EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="0"/>
                                                </DoubleAnimationUsingKeyFrames>
                                            </Storyboard>
                                        </BeginStoryboard>
                                    </Trigger.ExitActions>
                                    <Trigger.EnterActions>
                                        <BeginStoryboard >
                                            <Storyboard >
                                                <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)" Storyboard.TargetName="path">
                                                    <EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="1"/>
                                                </DoubleAnimationUsingKeyFrames>
                                                <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)" Storyboard.TargetName="path">
                                                    <EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="1"/>
                                                </DoubleAnimationUsingKeyFrames>
                                            </Storyboard>
                                        </BeginStoryboard>
                                    </Trigger.EnterActions>
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

    效果:

  • 相关阅读:
    XAMPP安装和配置
    Myeclipse下使用Maven搭建spring boot2.0项目
    activemq学习总结 (转)Java消息队列--ActiveMq 实战
    websocket学习总结
    Redis学习总结
    (转)使用OpenGL显示图像(七)Android OpenGLES2.0——纹理贴图之显示图片
    当网卡收到的包的目的地址是主机上另一个网卡的地址.arp总结
    当网卡收到一个包的目的地址是本主机其他接口的IP时.2
    网络设置中设置失败
    当网卡收到一个包的目的地址不是自己的地址时
  • 原文地址:https://www.cnblogs.com/qq2806933146xiaobai/p/16301054.html
Copyright © 2020-2023  润新知