Files
community/InkCanvasForClass/Components/ToggleSwitch.xaml
T
2025-08-23 21:39:21 +08:00

24 lines
1.6 KiB
XML

<UserControl x:Class="Ink_Canvas.Components.ToggleSwitch"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Ink_Canvas.Components"
mc:Ignorable="d">
<Grid>
<Border x:Name="BackgroundBorder" Width="48" Height="25" Background="{Binding SwitchBackground, RelativeSource={RelativeSource AncestorType=UserControl}}" VerticalAlignment="Center" HorizontalAlignment="Right" CornerRadius="12" Padding="3,0">
<Grid>
<Border x:Name="ThumbBorder" Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center">
<Border.Effect>
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"></DropShadowEffect>
</Border.Effect>
<Border.RenderTransform>
<TranslateTransform x:Name="ThumbTranslateTransform" X="0"></TranslateTransform>
</Border.RenderTransform>
</Border>
<Border x:Name="OverlayBorder" Visibility="Hidden" IsHitTestVisible="False" Width="48" Height="25" Background="Black" Opacity="0.2" Margin="-3,0" VerticalAlignment="Center" HorizontalAlignment="Right" CornerRadius="12"/>
</Grid>
</Border>
</Grid>
</UserControl>