将自定义控件单开一个项目

This commit is contained in:
PrefacedCorg
2026-04-13 13:01:14 +08:00
parent 0a14d96e10
commit 41be1e901d
13 changed files with 57 additions and 7 deletions
@@ -0,0 +1,26 @@
<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>