-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
189 additions
and
4 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,174 @@ | ||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:svd="clr-namespace:SyminUI.Controls.Decorations"> | ||
<!--TODO:可调整光影颜色--> | ||
<Style TargetType="{x:Type ToggleButton}"> | ||
<Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}"/> | ||
<Setter Property="Background" Value="{StaticResource Background.Main}"/> | ||
<Setter Property="BorderBrush" Value="{StaticResource Background.Main}"/> | ||
<Setter Property="Foreground" Value="{StaticResource Text.Main}"/> | ||
<Setter Property="BorderThickness" Value="0"/> | ||
<Setter Property="HorizontalContentAlignment" Value="Center"/> | ||
<Setter Property="VerticalContentAlignment" Value="Center"/> | ||
<Setter Property="Padding" Value="12,4"/> | ||
<Setter Property="Template"> | ||
<Setter.Value> | ||
<ControlTemplate TargetType="{x:Type ToggleButton}"> | ||
<svd:EmbossBorder x:Name="border" Intensity="0.6" | ||
Background="{TemplateBinding BorderBrush}" | ||
BorderBrush="{TemplateBinding BorderBrush}" | ||
BorderThickness="{TemplateBinding BorderThickness}"> | ||
<svd:SlotBorder x:Name="slot" Intensity="0" ShaderEnabled="False" | ||
Background="{TemplateBinding Background}"> | ||
<ContentPresenter x:Name="contentPresenter" Focusable="False" | ||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" | ||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" | ||
Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" | ||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" /> | ||
</svd:SlotBorder> | ||
</svd:EmbossBorder> | ||
<ControlTemplate.Triggers> | ||
<Trigger Property="Button.IsDefaulted" Value="true"> | ||
</Trigger> | ||
<Trigger Property="IsMouseOver" Value="true"> | ||
<Setter Property="ShaderEnabled" TargetName="slot" Value="True"/> | ||
</Trigger> | ||
<Trigger Property="IsPressed" Value="true"> | ||
<Setter Property="Intensity" TargetName="slot" | ||
Value="0.9"/> | ||
</Trigger> | ||
<Trigger Property="IsEnabled" Value="false"> | ||
<Setter Property="Background" TargetName="border" | ||
Value="{StaticResource Background.Button.Disabled}"/> | ||
<Setter Property="TextElement.Foreground" TargetName="contentPresenter" | ||
Value="{StaticResource Text.Main.Disabled}"/> | ||
</Trigger> | ||
<MultiTrigger> | ||
<MultiTrigger.Conditions> | ||
<Condition Property="IsChecked" Value="True"/> | ||
<Condition Property="IsPressed" Value="False"/> | ||
</MultiTrigger.Conditions> | ||
<Setter Property="Intensity" TargetName="slot" Value="0.6"/> | ||
<Setter Property="ShaderEnabled" TargetName="slot" Value="True"/> | ||
</MultiTrigger> | ||
</ControlTemplate.Triggers> | ||
</ControlTemplate> | ||
</Setter.Value> | ||
</Setter> | ||
</Style> | ||
<Style x:Key="SwitchButton" TargetType="{x:Type ToggleButton}"> | ||
<Style.Resources> | ||
<Storyboard x:Key="ToggleSwitchOn"> | ||
<ThicknessAnimationUsingKeyFrames Duration="0:0:0.2" | ||
Storyboard.TargetProperty="Margin" | ||
Storyboard.TargetName="circleBox"> | ||
<LinearThicknessKeyFrame KeyTime="0" Value="0,0,19,0"/> | ||
<SplineThicknessKeyFrame KeyTime="0:0:0.2" Value="0,0,1,0" | ||
KeySpline="0.8,1 0.8,1"/> | ||
</ThicknessAnimationUsingKeyFrames> | ||
<DoubleAnimationUsingKeyFrames Duration="0:0:0.2" | ||
Storyboard.TargetProperty="Opacity" | ||
Storyboard.TargetName="borderOff"> | ||
<LinearDoubleKeyFrame KeyTime="0" Value="1"/> | ||
<SplineDoubleKeyFrame KeyTime="0:0:0.2" Value="0" | ||
KeySpline="0.8,1 0.8,1"/> | ||
</DoubleAnimationUsingKeyFrames> | ||
<DoubleAnimationUsingKeyFrames Duration="0:0:0.2" | ||
Storyboard.TargetProperty="Opacity" | ||
Storyboard.TargetName="borderOn"> | ||
<LinearDoubleKeyFrame KeyTime="0" Value="0"/> | ||
<SplineDoubleKeyFrame KeyTime="0:0:0.2" Value="1" | ||
KeySpline="0.8,1 0.8,1"/> | ||
</DoubleAnimationUsingKeyFrames> | ||
</Storyboard> | ||
<Storyboard x:Key="ToggleSwitchOff"> | ||
<ThicknessAnimationUsingKeyFrames Duration="0:0:0.2" | ||
Storyboard.TargetProperty="Margin" | ||
Storyboard.TargetName="circleBox"> | ||
<LinearThicknessKeyFrame KeyTime="0" Value="19,0,0,0"/> | ||
<SplineThicknessKeyFrame KeyTime="0:0:0.2" Value="1,0,0,0" | ||
KeySpline="0.8,1 0.8,1"/> | ||
</ThicknessAnimationUsingKeyFrames> | ||
<DoubleAnimationUsingKeyFrames Duration="0:0:0.2" | ||
Storyboard.TargetProperty="Opacity" | ||
Storyboard.TargetName="borderOff"> | ||
<LinearDoubleKeyFrame KeyTime="0" Value="0"/> | ||
<SplineDoubleKeyFrame KeyTime="0:0:0.2" Value="1" | ||
KeySpline="0.8,1 0.8,1"/> | ||
</DoubleAnimationUsingKeyFrames> | ||
<DoubleAnimationUsingKeyFrames Duration="0:0:0.2" | ||
Storyboard.TargetProperty="Opacity" | ||
Storyboard.TargetName="borderOn"> | ||
<LinearDoubleKeyFrame KeyTime="0" Value="1"/> | ||
<SplineDoubleKeyFrame KeyTime="0:0:0.2" Value="0" | ||
KeySpline="0.8,1 0.8,1"/> | ||
</DoubleAnimationUsingKeyFrames> | ||
</Storyboard> | ||
</Style.Resources> | ||
<Setter Property="Background" Value="{StaticResource Background.Toggle}"/> | ||
<Setter Property="Foreground" Value="{StaticResource Gradient.Primary}"/> | ||
<Setter Property="BorderBrush" Value="{StaticResource Border.MainBrush}"/> | ||
<Setter Property="Margin" Value="4"/> | ||
<Setter Property="Template"> | ||
<Setter.Value> | ||
<ControlTemplate TargetType="{x:Type ToggleButton}"> | ||
<Grid Height="24" Width="42"> | ||
<Border x:Name="borderOn" CornerRadius="12" | ||
Opacity="0" | ||
Background="{TemplateBinding Foreground}"/> | ||
|
||
<Border x:Name="borderOff" CornerRadius="12" | ||
Opacity="1" BorderThickness="1" | ||
BorderBrush="{TemplateBinding BorderBrush}" | ||
Background="{TemplateBinding Background}"> | ||
|
||
</Border> | ||
<Grid x:Name="circleBox" Width="20" Height="20" Margin="1,0,0,0" | ||
HorizontalAlignment="Left"> | ||
<Border x:Name="circle" | ||
Background="{StaticResource Background.Button}" | ||
CornerRadius="8" Margin="2"> | ||
<Border.Effect> | ||
<DropShadowEffect BlurRadius="6" Opacity="0.6" ShadowDepth="2" | ||
Color="{StaticResource Shader.ShadowColor}"/> | ||
</Border.Effect> | ||
</Border> | ||
</Grid> | ||
|
||
</Grid> | ||
<ControlTemplate.Triggers> | ||
<Trigger Property="Button.IsDefaulted" Value="true"> | ||
</Trigger> | ||
<Trigger Property="IsMouseOver" Value="true"> | ||
<Setter Property="Margin" TargetName="circle" Value="1"/> | ||
<Setter Property="CornerRadius" TargetName="circle" Value="9"/> | ||
</Trigger> | ||
<Trigger Property="IsPressed" Value="true"> | ||
<Setter Property="Width" TargetName="circleBox" Value="24"/> | ||
</Trigger> | ||
<Trigger Property="IsEnabled" Value="false"> | ||
<Setter Property="Background" TargetName="circle" | ||
Value="{StaticResource Background.Button.Disabled}"/> | ||
<Setter Property="Background" TargetName="borderOn" | ||
Value="{StaticResource Primary.Disabled}"/> | ||
<Setter Property="Background" TargetName="borderOff" | ||
Value="{StaticResource Background.Toggle.Disabled}"/> | ||
</Trigger> | ||
<Trigger Property="IsChecked" Value="True"> | ||
<Setter Property="HorizontalAlignment" TargetName="circleBox" | ||
Value="Right"/> | ||
<Setter Property="Margin" TargetName="circleBox" | ||
Value="0,0,11,0"/> | ||
<Trigger.EnterActions> | ||
<BeginStoryboard Storyboard="{StaticResource ToggleSwitchOn}"/> | ||
</Trigger.EnterActions> | ||
<Trigger.ExitActions> | ||
<BeginStoryboard Storyboard="{StaticResource ToggleSwitchOff}"/> | ||
</Trigger.ExitActions> | ||
</Trigger> | ||
</ControlTemplate.Triggers> | ||
</ControlTemplate> | ||
</Setter.Value> | ||
</Setter> | ||
</Style> | ||
</ResourceDictionary> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters