Files
community/Ink Canvas/Windows/SettingsViews/Pages/CanvasPage.xaml
T
PrefacedCorg ef5377f85c feat(设置): 新增个性化设置页面并重构主题相关功能
重构主题和语言设置功能,将相关代码从主窗口迁移至新增的个性化设置页面
优化浮动工具栏图标选择逻辑,移除冗余代码
统一设置页面中开关控件的样式和行为
修复设置页面导航项的选择状态问题
2026-04-25 17:00:02 +08:00

290 lines
20 KiB
XML

<ui:Page x:Class="Ink_Canvas.Windows.SettingsViews.Pages.CanvasPage"
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.Windows.SettingsViews.Pages"
xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern"
xmlns:ikw="http://schemas.inkore.net/lib/ui/wpf"
xmlns:i18n="clr-namespace:Ink_Canvas.MarkupExtensions"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
xmlns:controls="clr-namespace:Ink_Canvas.Controls;assembly=InkCanvas.Controls"
xmlns:c="clr-namespace:Ink_Canvas.Converter"
mc:Ignorable="d"
Title="画板">
<ScrollViewer PanningMode="VerticalFirst">
<Grid Margin="59,0,59,0">
<FrameworkElement.Resources>
<sys:Double x:Key="SettingsCardSpacing">4</sys:Double>
<c:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
<Style x:Key="SettingsSectionHeaderTextBlockStyle"
BasedOn="{StaticResource BodyStrongTextBlockStyle}"
TargetType="TextBlock">
<Style.Setters>
<Setter Property="Margin" Value="1,30,0,6" />
</Style.Setters>
</Style>
</FrameworkElement.Resources>
<Grid>
<ikw:SimpleStackPanel MaxWidth="1000" HorizontalAlignment="Stretch"
Spacing="{StaticResource SettingsCardSpacing}">
<TextBlock Style="{StaticResource SettingsSectionHeaderTextBlockStyle}"
Text="{i18n:I18n Key=Canvas_GroupTitle}" />
<controls:LabeledSettingsCard x:Name="CardShowCursor"
Header="{i18n:I18n Key=Canvas_ShowCursor}"
Icon="{x:Static ui:SegoeFluentIcons.PointerHand}"
SwitchName="ToggleSwitchShowCursor"
Toggled="ToggleSwitchShowCursor_Toggled" />
<controls:LabeledSettingsCard x:Name="CardEnablePressureTouchMode"
Header="{i18n:I18n Key=Canvas_EnablePressureTouch}"
Description="{i18n:I18n Key=Canvas_EnablePressureTouchHint}"
Icon="{x:Static ui:SegoeFluentIcons.Touch}"
SwitchName="ToggleSwitchEnablePressureTouchMode"
Toggled="ToggleSwitchEnablePressureTouchMode_Toggled" />
<controls:LabeledSettingsCard x:Name="CardDisablePressure"
Header="{i18n:I18n Key=Canvas_DisablePressure}"
Description="{i18n:I18n Key=Canvas_DisablePressureHint}"
Icon="{x:Static ui:SegoeFluentIcons.TouchPointer}"
SwitchName="ToggleSwitchDisablePressure"
Toggled="ToggleSwitchDisablePressure_Toggled" />
<ui:SettingsCard Header="{i18n:I18n Key=Canvas_EraserSize}"
Description="{i18n:I18n Key=Canvas_EraserSizeHint}">
<ui:SettingsCard.HeaderIcon>
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.EraseTool}" />
</ui:SettingsCard.HeaderIcon>
<ComboBox x:Name="ComboBoxEraserSize"
SelectedIndex="1"
SelectionChanged="ComboBoxEraserSize_SelectionChanged">
<ComboBoxItem Content="{i18n:I18n Key=Canvas_EraserSize_VerySmall}" />
<ComboBoxItem Content="{i18n:I18n Key=Canvas_EraserSize_Small}" />
<ComboBoxItem Content="{i18n:I18n Key=Canvas_EraserSize_Medium}" />
<ComboBoxItem Content="{i18n:I18n Key=Canvas_EraserSize_Large}" />
<ComboBoxItem Content="{i18n:I18n Key=Canvas_EraserSize_VeryLarge}" />
</ComboBox>
</ui:SettingsCard>
<controls:LabeledSettingsCard x:Name="CardHideStrokeWhenSelecting"
Header="{i18n:I18n Key=Canvas_HideStrokeWhenSelecting}"
Description="{i18n:I18n Key=Canvas_HideStrokeWhenSelectingHint}"
Icon="{x:Static ui:SegoeFluentIcons.Hide}"
SwitchName="ToggleSwitchHideStrokeWhenSelecting"
Toggled="ToggleSwitchHideStrokeWhenSelecting_Toggled" />
<controls:LabeledSettingsCard x:Name="CardClearCanvasAndClearTimeMachine"
Header="{i18n:I18n Key=Canvas_ClearInkAlsoClearHistory}"
Icon="{x:Static ui:SegoeFluentIcons.Delete}"
SwitchName="ToggleSwitchClearCanvasAndClearTimeMachine"
Toggled="ToggleSwitchClearCanvasAndClearTimeMachine_Toggled" />
<controls:LabeledSettingsCard x:Name="CardClearCanvasAlsoClearImages"
Header="{i18n:I18n Key=Canvas_ClearCanvasAlsoClearImages}"
Icon="{x:Static ui:SegoeFluentIcons.Photo}"
SwitchName="ToggleSwitchClearCanvasAlsoClearImages"
Toggled="ToggleSwitchClearCanvasAlsoClearImages_Toggled" />
<controls:LabeledSettingsCard x:Name="CardCompressPicturesUploaded"
Header="{i18n:I18n Key=Canvas_CompressPicturesUploaded}"
Icon="{x:Static ui:SegoeFluentIcons.Clear}"
SwitchName="ToggleSwitchCompressPicturesUploaded"
Toggled="ToggleSwitchCompressPicturesUploaded_Toggled" />
<controls:LabeledSettingsCard x:Name="CardLaunchSeewoVideoShowcaseForWhiteboardBooth"
Header="{i18n:I18n Key=Canvas_LaunchSeewoVideoShowcaseForWhiteboardBooth}"
Description="{i18n:I18n Key=Canvas_LaunchSeewoVideoShowcaseForWhiteboardBoothHint}"
Icon="{x:Static ui:SegoeFluentIcons.Video}"
SwitchName="ToggleSwitchLaunchSeewoVideoShowcaseForWhiteboardBooth"
Toggled="ToggleSwitchLaunchSeewoVideoShowcaseForWhiteboardBooth_Toggled" />
<ui:SettingsCard Header="{i18n:I18n Key=Canvas_KeepHyperbolaAsymptote}"
Description="{i18n:I18n Key=Canvas_HyperbolaAsymptoteHint}">
<ui:SettingsCard.HeaderIcon>
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.AreaChart}" />
</ui:SettingsCard.HeaderIcon>
<ComboBox x:Name="ComboBoxHyperbolaAsymptoteOption"
SelectedIndex="0"
SelectionChanged="ComboBoxHyperbolaAsymptoteOption_SelectionChanged">
<ComboBoxItem Content="{i18n:I18n Key=Canvas_Yes}" />
<ComboBoxItem Content="{i18n:I18n Key=Canvas_No}" />
<ComboBoxItem Content="{i18n:I18n Key=Canvas_AskEachTime}" />
</ComboBox>
</ui:SettingsCard>
<controls:LabeledSettingsCard x:Name="CardShowCircleCenter"
Header="{i18n:I18n Key=Canvas_ShowCircleCenter}"
Icon="{x:Static ui:SegoeFluentIcons.CircleRing}"
SwitchName="ToggleSwitchShowCircleCenter"
Toggled="ToggleSwitchShowCircleCenter_Toggled" />
<ui:SettingsCard Header="{i18n:I18n Key=Canvas_CurveSmoothingMode}">
<ui:SettingsCard.HeaderIcon>
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.InkingTool}" />
</ui:SettingsCard.HeaderIcon>
<ComboBox x:Name="ComboBoxCurveSmoothingMode"
SelectedIndex="0"
SelectionChanged="ComboBoxCurveSmoothingMode_SelectionChanged">
<ComboBoxItem Content="{i18n:I18n Key=Canvas_AdvancedBezierSmoothing}" Tag="2" />
<ComboBoxItem Content="{i18n:I18n Key=Canvas_WPFBezierSmoothing}" Tag="1" />
<ComboBoxItem Content="{i18n:I18n Key=Canvas_CurveSmoothing_Off}" Tag="0" />
</ComboBox>
</ui:SettingsCard>
<ui:SettingsExpander x:Name="ExpanderEnableInkFade"
Header="{i18n:I18n Key=Canvas_EnableInkFade}"
Description="{i18n:I18n Key=Canvas_EnableInkFadeHint}"
d:Visibility="Visible" d:IsExpanded="True">
<ui:SettingsExpander.HeaderIcon>
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Color}" />
</ui:SettingsExpander.HeaderIcon>
<ui:ToggleSwitch x:Name="ToggleSwitchEnableInkFade"
OnContent="{DynamicResource Common_On}"
OffContent="{DynamicResource Common_Off}"
Toggled="ToggleSwitchEnableInkFade_Toggled" />
<ui:SettingsExpander.Items>
<ui:SettingsCard Header="{i18n:I18n Key=Canvas_InkFadeTime}">
<ikw:SimpleStackPanel Orientation="Horizontal" Spacing="12">
<Slider x:Name="InkFadeTimeSlider" Width="150" Minimum="1000" Maximum="10000"
Value="3000" TickFrequency="1000" IsSnapToTickEnabled="True"
ValueChanged="InkFadeTimeSlider_ValueChanged" />
<TextBlock Text="{Binding Value, ElementName=InkFadeTimeSlider, StringFormat={}{0:0}ms}"
VerticalAlignment="Center" FontSize="14" />
</ikw:SimpleStackPanel>
</ui:SettingsCard>
</ui:SettingsExpander.Items>
</ui:SettingsExpander>
<controls:LabeledSettingsCard x:Name="CardHideInkFadeControlInPenMenu"
Header="{i18n:I18n Key=Canvas_HideInkFadeInPenMenu}"
Description="{i18n:I18n Key=Canvas_HideInkFadeInPenMenuHint}"
Icon="{x:Static ui:SegoeFluentIcons.Hide}"
SwitchName="ToggleSwitchHideInkFadeControlInPenMenu"
Toggled="ToggleSwitchHideInkFadeControlInPenMenu_Toggled" />
<ui:SettingsExpander x:Name="ExpanderBrushAutoRestore"
Header="{i18n:I18n Key=Canvas_BrushAutoRestore}"
Description="{i18n:I18n Key=Canvas_BrushAutoRestoreHint}"
d:Visibility="Visible" d:IsExpanded="True">
<ui:SettingsExpander.HeaderIcon>
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Refresh}" />
</ui:SettingsExpander.HeaderIcon>
<ui:ToggleSwitch x:Name="ToggleSwitchBrushAutoRestore"
OnContent="{DynamicResource Common_On}"
OffContent="{DynamicResource Common_Off}"
Toggled="ToggleSwitchBrushAutoRestore_Toggled" />
<ui:SettingsExpander.Items>
<ui:SettingsCard Header="{i18n:I18n Key=Canvas_AutoRestoreTimePoints}">
<TextBox x:Name="BrushAutoRestoreTimesTextBox" Width="260"
TextChanged="BrushAutoRestoreTimesTextBox_TextChanged" />
</ui:SettingsCard>
<ui:SettingsCard Header="{i18n:I18n Key=Canvas_RestoreColor}">
<ComboBox x:Name="ComboBoxBrushAutoRestoreColor"
SelectionChanged="ComboBoxBrushAutoRestoreColor_SelectionChanged">
<ComboBoxItem Content="{i18n:I18n Key=Canvas_Color_Default}" Tag="#FFFF0000" />
<ComboBoxItem Content="{i18n:I18n Key=Canvas_Color_Black}" Tag="#FF000000" />
<ComboBoxItem Content="{i18n:I18n Key=Canvas_Color_White}" Tag="#FFFFFFFF" />
<ComboBoxItem Content="{i18n:I18n Key=Canvas_Color_Red}" Tag="#FFFF0000" />
<ComboBoxItem Content="{i18n:I18n Key=Canvas_Color_Yellow}" Tag="#FFFFFF00" />
<ComboBoxItem Content="{i18n:I18n Key=Canvas_Color_Blue}" Tag="#FF2563EB" />
<ComboBoxItem Content="{i18n:I18n Key=Canvas_Color_Green}" Tag="#FF16A34A" />
<ComboBoxItem Content="{i18n:I18n Key=Canvas_Color_Orange}" Tag="#FFFB9650" />
<ComboBoxItem Content="{i18n:I18n Key=Canvas_Color_Purple}" Tag="#FF9333EA" />
</ComboBox>
</ui:SettingsCard>
<ui:SettingsCard Header="{i18n:I18n Key=Canvas_RestoreWidth}">
<ikw:SimpleStackPanel Orientation="Horizontal" Spacing="12">
<Slider x:Name="BrushAutoRestoreWidthSlider" Width="200" Minimum="1" Maximum="20"
TickFrequency="1" IsSnapToTickEnabled="True" Value="5"
ValueChanged="BrushAutoRestoreWidthSlider_ValueChanged" />
<TextBlock Text="{Binding Value, ElementName=BrushAutoRestoreWidthSlider, StringFormat={}{0:0}px}"
FontSize="12" VerticalAlignment="Center" />
</ikw:SimpleStackPanel>
</ui:SettingsCard>
<ui:SettingsCard Header="{i18n:I18n Key=Canvas_RestoreOpacity}">
<ikw:SimpleStackPanel Orientation="Horizontal" Spacing="12">
<Slider x:Name="BrushAutoRestoreAlphaSlider" Width="200" Minimum="0" Maximum="255"
TickFrequency="5" IsSnapToTickEnabled="True"
ValueChanged="BrushAutoRestoreAlphaSlider_ValueChanged" />
<TextBlock Text="{Binding Value, ElementName=BrushAutoRestoreAlphaSlider, StringFormat={}{0:0}}"
FontSize="12" VerticalAlignment="Center" />
</ikw:SimpleStackPanel>
</ui:SettingsCard>
</ui:SettingsExpander.Items>
</ui:SettingsExpander>
<ui:SettingsExpander x:Name="ExpanderEnableEraserAutoSwitchBack"
Header="{i18n:I18n Key=Canvas_SwitchBackAfterEraser}"
Description="{i18n:I18n Key=Canvas_SwitchBackAfterEraserHint}"
d:Visibility="Visible" d:IsExpanded="True">
<ui:SettingsExpander.HeaderIcon>
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Switch}" />
</ui:SettingsExpander.HeaderIcon>
<ui:ToggleSwitch x:Name="ToggleSwitchEnableEraserAutoSwitchBack"
OnContent="{DynamicResource Common_On}"
OffContent="{DynamicResource Common_Off}"
Toggled="ToggleSwitchEnableEraserAutoSwitchBack_Toggled" />
<ui:SettingsExpander.Items>
<ui:SettingsCard Header="{i18n:I18n Key=Canvas_SwitchBackDelay}"
Description="{i18n:I18n Key=Canvas_SwitchBackDelayHint}">
<ikw:SimpleStackPanel Orientation="Horizontal" Spacing="12">
<Slider x:Name="EraserAutoSwitchBackDelaySlider" Width="150" Minimum="1" Maximum="60"
Value="10" TickFrequency="1" IsSnapToTickEnabled="True"
ValueChanged="EraserAutoSwitchBackDelaySlider_ValueChanged" />
<TextBlock Text="{Binding Value, ElementName=EraserAutoSwitchBackDelaySlider, StringFormat={}{0:0}秒}"
VerticalAlignment="Center" FontSize="14" />
</ikw:SimpleStackPanel>
</ui:SettingsCard>
</ui:SettingsExpander.Items>
</ui:SettingsExpander>
<TextBlock Style="{StaticResource SettingsSectionHeaderTextBlockStyle}"
Text="{i18n:I18n Key=Gesture_Title}" />
<controls:LabeledSettingsCard x:Name="CardAutoSwitchTwoFingerGesture"
Header="{i18n:I18n Key=Gesture_AutoToggleTwoFinger}"
Description="{i18n:I18n Key=Gesture_AutoToggleHint}"
Icon="{x:Static ui:SegoeFluentIcons.Switch}"
SwitchName="ToggleSwitchAutoSwitchTwoFingerGesture"
Toggled="ToggleSwitchAutoSwitchTwoFingerGesture_Toggled" />
<controls:LabeledSettingsCard x:Name="CardEnableTwoFingerRotationOnSelection"
Header="{i18n:I18n Key=Gesture_AllowRotateScale}"
Description="{i18n:I18n Key=Gesture_AllowRotateScaleHint}"
Icon="{x:Static ui:SegoeFluentIcons.Rotate}"
SwitchName="ToggleSwitchEnableTwoFingerRotationOnSelection"
Toggled="ToggleSwitchEnableTwoFingerRotationOnSelection_Toggled" />
<ui:SettingsExpander x:Name="ExpanderEnablePalmEraser"
Header="{i18n:I18n Key=Gesture_EnablePalmEraser}"
Description="{i18n:I18n Key=Gesture_PalmHint}"
d:Visibility="Visible" d:IsExpanded="True">
<ui:SettingsExpander.HeaderIcon>
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.EraseTool}" />
</ui:SettingsExpander.HeaderIcon>
<ui:ToggleSwitch x:Name="ToggleSwitchEnablePalmEraser"
OnContent="{DynamicResource Common_On}"
OffContent="{DynamicResource Common_Off}"
Toggled="ToggleSwitchEnablePalmEraser_Toggled" />
<ui:SettingsExpander.Items>
<ui:SettingsCard Header="{i18n:I18n Key=Gesture_PalmSensitivity}">
<ComboBox x:Name="ComboBoxPalmEraserSensitivity"
SelectionChanged="ComboBoxPalmEraserSensitivity_SelectionChanged">
<ComboBoxItem Content="{i18n:I18n Key=Gesture_PalmSensitivityLow}" />
<ComboBoxItem Content="{i18n:I18n Key=Gesture_PalmSensitivityMedium}" />
<ComboBoxItem Content="{i18n:I18n Key=Gesture_PalmSensitivityHigh}" />
</ComboBox>
</ui:SettingsCard>
</ui:SettingsExpander.Items>
</ui:SettingsExpander>
<Rectangle Height="48" />
</ikw:SimpleStackPanel>
</Grid>
</Grid>
</ScrollViewer>
</ui:Page>