Files
community/InkCanvas.Controls/LabeledToggleSwitch.xaml
2026-04-13 13:01:14 +08:00

27 lines
1.6 KiB
XML

<UserControl x:Class="Ink_Canvas.Controls.LabeledToggleSwitch"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern"
xmlns:ikw="http://schemas.inkore.net/lib/ui/wpf">
<ikw:SimpleStackPanel Spacing="4">
<ikw:SimpleStackPanel Orientation="Horizontal" HorizontalAlignment="Left">
<TextBlock Text="{Binding Label, RelativeSource={RelativeSource AncestorType=UserControl}}"
VerticalAlignment="Center"
Foreground="#fafafa"
FontSize="14"
Margin="0,0,16,0"/>
<ui:ToggleSwitch x:Name="ToggleSwitch"
OnContent="{Binding OnContent, RelativeSource={RelativeSource AncestorType=UserControl}}"
OffContent="{Binding OffContent, RelativeSource={RelativeSource AncestorType=UserControl}}"
IsOn="{Binding IsOn, RelativeSource={RelativeSource AncestorType=UserControl}, Mode=TwoWay}"
FontWeight="Bold"
Toggled="ToggleSwitch_Toggled"/>
</ikw:SimpleStackPanel>
<TextBlock x:Name="HintTextBlock"
Text="{Binding Hint, RelativeSource={RelativeSource AncestorType=UserControl}}"
TextWrapping="Wrap"
Foreground="#a1a1aa"
Visibility="Collapsed"/>
</ikw:SimpleStackPanel>
</UserControl>