随笔 - 210  文章 - 34 评论 - 150 trackbacks - 29

<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>

  

posted on 2020-04-16 15:09  Louis.Lu.Sz  阅读(91)  评论(0编辑  收藏