WPF简单实现可以左右滑动的CheckBox复选框,样式模仿的微信

WPF简单实现可以左右滑动的CheckBox复选框,样式模仿的微信

<StackPanel Grid.Row="0" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,5,5,0">
                <TextBlock Text="自动刷新" FontSize="14" Margin="0,0,3,0" />
                <CheckBox Width="36" Height="18" Cursor="Hand" IsChecked="{Binding AutoRefreshNewRecipe}">
                    <CheckBox.Template>
                        <ControlTemplate TargetType="CheckBox">
                            <Border Width="{TemplateBinding Width}" Height="{TemplateBinding Height}" CornerRadius="8" Background="{TemplateBinding Background}">
                                <Grid Name="btn" Width="{TemplateBinding Height}" Height="{TemplateBinding Height}" HorizontalAlignment="Left">
                                    <Ellipse Margin="1">
                                        <Ellipse.Fill>
                                            <RadialGradientBrush>
                                                <GradientStop Color="White" />
                                            </RadialGradientBrush>
                                        </Ellipse.Fill>
                                    </Ellipse>
                                </Grid>
                            </Border>
                            <ControlTemplate.Triggers>
                                <Trigger Property="IsChecked" Value="false">
                                    <Setter Property="Background" Value="#FFC2C3C9" />
                                    <Setter TargetName="btn" Property="HorizontalAlignment" Value="Left"/>
                                </Trigger>
                                <Trigger Property="IsChecked" Value="true">
                                    <Setter Property="Background" Value="#FF1A66A2" />
                                    <Setter TargetName="btn" Property="HorizontalAlignment" Value="Right"/>
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </CheckBox.Template>
                </CheckBox>
            </StackPanel>

  

WPF简单实现可以左右滑动的CheckBox复选框,样式模仿的微信

上一篇:微信小程序页面跳转方法总结


下一篇:微信群发助手 附僵尸粉检测—免费版,清理微信被删除好友