123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126 |
- <ResourceDictionary
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:ctrl="http://OpenSEMI.Ctrlib.com/presentation"
- mc:Ignorable="d">
- <LinearGradientBrush x:Key="ButtonNormalBackgroundFill" EndPoint="0.5,1" StartPoint="0.5,0">
- <GradientStop Color="#FFFFFFFF" Offset="0"/>
- <GradientStop Color="#FFF0F0EA" Offset="0.9"/>
- </LinearGradientBrush>
- <SolidColorBrush x:Key="ButtonBorder" Color="Transparent"/>
- <Style x:Key="ToggleButtonStyle1" TargetType="{x:Type ToggleButton}">
- <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
- <Setter Property="Background" Value="{StaticResource ButtonNormalBackgroundFill}"/>
- <Setter Property="BorderBrush" Value="{StaticResource ButtonBorder}"/>
- <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
- <Setter Property="HorizontalContentAlignment" Value="Center"/>
- <Setter Property="VerticalContentAlignment" Value="Center"/>
- <Setter Property="Cursor" Value="Hand"/>
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type ToggleButton}">
- <ControlTemplate.Resources>
- <Storyboard x:Key="OnChecked1">
- <ThicknessAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Margin)" Storyboard.TargetName="path">
- <EasingThicknessKeyFrame KeyTime="0:0:0.2" Value="110,0,0,0"/>
- </ThicknessAnimationUsingKeyFrames>
- <ThicknessAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Margin)" Storyboard.TargetName="path1">
- <EasingThicknessKeyFrame KeyTime="0:0:0.2" Value="110,0,0,0"/>
- </ThicknessAnimationUsingKeyFrames>
- <ThicknessAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Margin)" Storyboard.TargetName="path2">
- <EasingThicknessKeyFrame KeyTime="0:0:0.2" Value="110,0,0,0"/>
- </ThicknessAnimationUsingKeyFrames>
- <StringAnimationUsingKeyFrames Storyboard.TargetProperty="(TextBlock.Text)" Storyboard.TargetName="displayText">
- <DiscreteStringKeyFrame KeyTime="0" Value="Enable"/>
- </StringAnimationUsingKeyFrames>
- </Storyboard>
- <Storyboard x:Key="OnUnchecked1">
- <ThicknessAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Margin)" Storyboard.TargetName="path">
- <EasingThicknessKeyFrame KeyTime="0" Value="60,0,0,0"/>
- <EasingThicknessKeyFrame KeyTime="0:0:0.2" Value="0"/>
- </ThicknessAnimationUsingKeyFrames>
- <ThicknessAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Margin)" Storyboard.TargetName="path1">
- <EasingThicknessKeyFrame KeyTime="0" Value="60,0,0,0"/>
- <EasingThicknessKeyFrame KeyTime="0:0:0.2" Value="0"/>
- </ThicknessAnimationUsingKeyFrames>
- <ThicknessAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Margin)" Storyboard.TargetName="path2">
- <EasingThicknessKeyFrame KeyTime="0" Value="60,0,0,0"/>
- <EasingThicknessKeyFrame KeyTime="0:0:0.2" Value="0"/>
- </ThicknessAnimationUsingKeyFrames>
- <StringAnimationUsingKeyFrames Storyboard.TargetProperty="(TextBlock.Text)" Storyboard.TargetName="displayText">
- <DiscreteStringKeyFrame KeyTime="0" Value="Disable"/>
- </StringAnimationUsingKeyFrames>
- </Storyboard>
- </ControlTemplate.Resources>
- <Border CornerRadius="20" Background="Green" Width="{TemplateBinding Width}" Height="40">
- <Grid>
- <TextBlock x:Name="displayText" Text="Disable" Foreground="Black" FontSize="20" VerticalAlignment="Center">
- <TextBlock.Style>
- <Style TargetType="TextBlock">
- <Style.Triggers>
- <Trigger Property="Text" Value="Disable">
- <Setter Property="HorizontalAlignment" Value="Right"/>
- <Setter Property="Padding" Value="0,0,15,0"/>
- </Trigger>
- <Trigger Property="Text" Value="EN">
- <Setter Property="HorizontalAlignment" Value="Left"/>
- <Setter Property="Padding" Value="15,0,0,0"/>
- </Trigger>
- </Style.Triggers>
- </Style>
- </TextBlock.Style>
- </TextBlock>
- <Path x:Name="path2" Fill="Transparent">
- <Path.Data>
- <GeometryGroup>
- <GeometryGroup.Children>
- <EllipseGeometry Center="20,20" RadiusX="17" RadiusY="17"></EllipseGeometry>
- </GeometryGroup.Children>
- </GeometryGroup>
- </Path.Data>
- </Path>
- <Path x:Name="path1" Fill="Transparent">
- <Path.Data>
- <GeometryGroup>
- <GeometryGroup.Children>
- <EllipseGeometry Center="20,20" RadiusX="17" RadiusY="17"></EllipseGeometry>
- </GeometryGroup.Children>
- </GeometryGroup>
- </Path.Data>
- </Path>
- <Path x:Name="path">
- <Path.Fill>
- <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
- <GradientStop Color="#FF807F7F" Offset="0"/>
- <GradientStop Color="#FF373636" Offset="1"/>
- </LinearGradientBrush>
- </Path.Fill>
- <Path.Data>
- <GeometryGroup>
- <GeometryGroup.Children>
- <EllipseGeometry Center="20,20" RadiusX="17" RadiusY="17"></EllipseGeometry>
- </GeometryGroup.Children>
- </GeometryGroup>
- </Path.Data>
- </Path>
- </Grid>
- </Border>
- <ControlTemplate.Triggers>
- <EventTrigger RoutedEvent="ToggleButton.Checked">
- <BeginStoryboard Storyboard="{StaticResource OnChecked1}"/>
- </EventTrigger>
- <EventTrigger RoutedEvent="ToggleButton.Unchecked">
- <BeginStoryboard x:Name="OnUnchecked1_BeginStoryboard" Storyboard="{StaticResource OnUnchecked1}"/>
- </EventTrigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- </ResourceDictionary>
|