整理代码

This commit is contained in:
GG Z
2026-02-20 15:31:44 +08:00
parent 94cf3f3266
commit 9f121cfc7f
149 changed files with 4063 additions and 6964 deletions

View File

@@ -1,10 +1,10 @@
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:assists="clr-namespace:Melskin.Assists"
xmlns:controls="clr-namespace:Melskin.Controls"
xmlns:internal="clr-namespace:Melskin.Converters.Internal"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style TargetType="{x:Type ToggleButton}" x:Key="CodeSwitchStyle">
xmlns:internal="clr-namespace:Melskin.Converters.Internal">
<Style x:Key="CodeSwitchStyle" TargetType="{x:Type ToggleButton}">
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderThickness" Value="0" />
@@ -13,10 +13,10 @@
<Setter.Value>
<ControlTemplate TargetType="{x:Type ToggleButton}">
<Border
Padding="{TemplateBinding Padding}"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Padding="{TemplateBinding Padding}">
BorderThickness="{TemplateBinding BorderThickness}">
<ContentPresenter />
</Border>
</ControlTemplate>
@@ -55,63 +55,63 @@
</Grid.RowDefinitions>
<!-- Border -->
<Border
Grid.Row="0"
Grid.RowSpan="4"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{Binding Path=(assists:ControlAssist.CornerRadius), Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}"
Grid.Row="0"
Grid.RowSpan="4"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
<!-- Content -->
<ContentControl
Grid.Row="0"
Margin="{TemplateBinding Padding}"
Content="{TemplateBinding Content}"
ContentStringFormat="{TemplateBinding ContentStringFormat}"
ContentTemplate="{TemplateBinding ContentTemplate}"
ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}"
Grid.Row="0"
Margin="{TemplateBinding Padding}" />
ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}" />
<!-- Title -->
<ContentControl
Grid.Row="1"
Content="{TemplateBinding Title}"
ContentTemplate="{TemplateBinding TitleTemplate}"
Focusable="False"
Grid.Row="1" />
Focusable="False" />
<!-- Description -->
<ToggleButton
x:Name="CodeSwitch"
Grid.Row="2"
HorizontalAlignment="Right"
Margin="0,0,8,8"
Style="{StaticResource CodeSwitchStyle}"
ToolTip="Show Code"
HorizontalAlignment="Right"
VerticalAlignment="Bottom"
x:Name="CodeSwitch">
Style="{StaticResource CodeSwitchStyle}"
ToolTip="Show Code">
<controls:IconElement
Foreground="{Binding Path=Foreground, RelativeSource={RelativeSource AncestorType={x:Type ToggleButton}}}"
Height="16"
Symbol="CodeOff"
x:Name="CodeSwitchPath"
Width="16"
x:Name="CodeSwitchPath" />
Height="16"
Foreground="{Binding Path=Foreground, RelativeSource={RelativeSource AncestorType={x:Type ToggleButton}}}"
Symbol="CodeOff" />
</ToggleButton>
<ContentControl
Grid.Row="2"
Content="{TemplateBinding Description}"
ContentTemplate="{TemplateBinding DescriptionTemplate}"
Focusable="False"
Grid.Row="2" />
Focusable="False" />
<!-- Code -->
<ContentControl
x:Name="Code"
Grid.Row="3"
Content="{TemplateBinding Code}"
ContentTemplate="{TemplateBinding CodeTemplate}"
Focusable="False"
Grid.Row="3"
Visibility="Collapsed"
x:Name="Code" />
Visibility="Collapsed" />
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" SourceName="CodeSwitch" Value="True">
<Setter Property="ToolTip" TargetName="CodeSwitch" Value="Hide Code" />
<Setter Property="Symbol" TargetName="CodeSwitchPath" Value="Code" />
<Setter Property="Visibility" TargetName="Code" Value="Visible" />
<Trigger SourceName="CodeSwitch" Property="IsChecked" Value="True">
<Setter TargetName="CodeSwitch" Property="ToolTip" Value="Hide Code" />
<Setter TargetName="CodeSwitchPath" Property="Symbol" Value="Code" />
<Setter TargetName="Code" Property="Visibility" Value="Visible" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
@@ -122,18 +122,18 @@
<DataTemplate>
<Canvas>
<Border
BorderBrush="{Binding BorderBrush, RelativeSource={RelativeSource AncestorType={x:Type controls:CodeBox}}}"
BorderThickness="0,1,0,0"
Canvas.Left="0"
Canvas.Top="0"
Width="{Binding ActualWidth, RelativeSource={RelativeSource AncestorType={x:Type controls:CodeBox}}}" />
Width="{Binding ActualWidth, RelativeSource={RelativeSource AncestorType={x:Type controls:CodeBox}}}"
BorderBrush="{Binding BorderBrush, RelativeSource={RelativeSource AncestorType={x:Type controls:CodeBox}}}"
BorderThickness="0,1,0,0" />
<TextBlock
Background="{DynamicResource ControlBackgroundNormalBrush}"
Canvas.Left="32"
Canvas.Top="-10"
FontWeight="Medium"
Padding="8,1"
Panel.ZIndex="1"
Background="{DynamicResource ControlBackgroundNormalBrush}"
FontWeight="Medium"
Text="{TemplateBinding Content}" />
</Canvas>
</DataTemplate>
@@ -143,8 +143,8 @@
<Setter.Value>
<DataTemplate>
<ContentPresenter
Content="{Binding Content, RelativeSource={RelativeSource TemplatedParent}, Converter={x:Static internal:StringToMarkDownConverter.Instance}}"
Margin="32,18"
Content="{Binding Content, RelativeSource={RelativeSource TemplatedParent}, Converter={x:Static internal:StringToMarkDownConverter.Instance}}"
TextBlock.LineHeight="28" />
</DataTemplate>
</Setter.Value>
@@ -153,10 +153,10 @@
<Setter.Value>
<DataTemplate>
<Border
BorderBrush="{Binding BorderBrush, RelativeSource={RelativeSource AncestorType={x:Type controls:CodeBox}}}"
BorderThickness="0,1,0,0"
Width="{Binding ActualWidth, RelativeSource={RelativeSource AncestorType={x:Type controls:CodeBox}}}"
Padding="32,16"
Width="{Binding ActualWidth, RelativeSource={RelativeSource AncestorType={x:Type controls:CodeBox}}}">
BorderBrush="{Binding BorderBrush, RelativeSource={RelativeSource AncestorType={x:Type controls:CodeBox}}}"
BorderThickness="0,1,0,0">
<ContentPresenter Content="{Binding Content, RelativeSource={RelativeSource TemplatedParent}, Converter={x:Static internal:StringToCodeConverter.Instance}}" />
</Border>
</DataTemplate>