2025-07-31 20:12:01 +08:00
|
|
|
<ResourceDictionary
|
|
|
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
2025-08-20 12:10:35 +08:00
|
|
|
xmlns:assists="clr-namespace:NeoUI.Assists"
|
|
|
|
|
xmlns:controls="clr-namespace:NeoUI.Controls"
|
|
|
|
|
xmlns:converters="clr-namespace:NeoUI.Converters"
|
|
|
|
|
xmlns:internal="clr-namespace:NeoUI.Converters.Internal"
|
2025-07-31 20:12:01 +08:00
|
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
2025-08-12 23:08:54 +08:00
|
|
|
<Style TargetType="{x:Type ToggleButton}" x:Key="CodeSwitch">
|
|
|
|
|
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" />
|
2025-07-31 20:12:01 +08:00
|
|
|
<Setter Property="Background" Value="Transparent" />
|
|
|
|
|
<Setter Property="BorderThickness" Value="0" />
|
|
|
|
|
<Setter Property="Opacity" Value="0.55" />
|
|
|
|
|
<Setter Property="Template">
|
|
|
|
|
<Setter.Value>
|
|
|
|
|
<ControlTemplate TargetType="{x:Type ToggleButton}">
|
|
|
|
|
<Border
|
|
|
|
|
Background="{TemplateBinding Background}"
|
|
|
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
|
|
|
|
BorderThickness="{TemplateBinding BorderThickness}"
|
|
|
|
|
Padding="{TemplateBinding Padding}">
|
|
|
|
|
<ContentPresenter />
|
|
|
|
|
</Border>
|
|
|
|
|
</ControlTemplate>
|
|
|
|
|
</Setter.Value>
|
|
|
|
|
</Setter>
|
|
|
|
|
<Style.Triggers>
|
|
|
|
|
<Trigger Property="IsMouseOver" Value="True">
|
|
|
|
|
<Setter Property="Opacity" Value="1" />
|
|
|
|
|
</Trigger>
|
|
|
|
|
</Style.Triggers>
|
|
|
|
|
</Style>
|
|
|
|
|
|
|
|
|
|
<Style TargetType="{x:Type controls:CodeBox}">
|
2025-08-12 23:08:54 +08:00
|
|
|
<!--<Setter Property="FontFamily" Value="Chinese Quote" />-->
|
|
|
|
|
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" />
|
|
|
|
|
<Setter Property="Background" Value="{DynamicResource BackgroundContainerBrush}" />
|
|
|
|
|
<Setter Property="BorderBrush" Value="{DynamicResource BorderNormalBrush}" />
|
2025-07-31 20:12:01 +08:00
|
|
|
<Setter Property="BorderThickness" Value="1" />
|
2025-07-31 20:12:24 +08:00
|
|
|
<Setter Property="Margin" Value="0,0,0,16" />
|
2025-07-31 20:12:01 +08:00
|
|
|
<Setter Property="Padding" Value="24,42,24,50" />
|
|
|
|
|
<Setter Property="SnapsToDevicePixels" Value="True" />
|
2025-08-12 23:08:54 +08:00
|
|
|
<Setter Property="assists:ControlAssist.CornerRadius" Value="2" />
|
2025-07-31 20:12:01 +08:00
|
|
|
<Setter Property="Template">
|
|
|
|
|
<Setter.Value>
|
|
|
|
|
<ControlTemplate TargetType="{x:Type controls:CodeBox}">
|
|
|
|
|
<Grid UseLayoutRounding="True">
|
|
|
|
|
<Grid.RowDefinitions>
|
|
|
|
|
<!-- Content -->
|
|
|
|
|
<RowDefinition Height="Auto" />
|
|
|
|
|
<!-- Title -->
|
|
|
|
|
<RowDefinition Height="Auto" />
|
|
|
|
|
<!-- Description -->
|
|
|
|
|
<RowDefinition Height="Auto" />
|
|
|
|
|
<!-- Code -->
|
|
|
|
|
<RowDefinition Height="Auto" />
|
|
|
|
|
</Grid.RowDefinitions>
|
|
|
|
|
<!-- Border -->
|
|
|
|
|
<Border
|
|
|
|
|
Background="{TemplateBinding Background}"
|
|
|
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
|
|
|
|
BorderThickness="{TemplateBinding BorderThickness}"
|
2025-08-12 23:08:54 +08:00
|
|
|
CornerRadius="{Binding Path=(assists:ControlAssist.CornerRadius), Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}"
|
2025-07-31 20:12:01 +08:00
|
|
|
Grid.Row="0"
|
|
|
|
|
Grid.RowSpan="4"
|
|
|
|
|
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
|
|
|
|
|
<!-- Content -->
|
|
|
|
|
<ContentControl
|
|
|
|
|
Content="{TemplateBinding Content}"
|
|
|
|
|
ContentStringFormat="{TemplateBinding ContentStringFormat}"
|
|
|
|
|
ContentTemplate="{TemplateBinding ContentTemplate}"
|
|
|
|
|
ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}"
|
|
|
|
|
Margin="{TemplateBinding Padding}" />
|
|
|
|
|
<!-- Title -->
|
|
|
|
|
<ContentControl
|
|
|
|
|
Content="{TemplateBinding Title}"
|
|
|
|
|
ContentTemplate="{TemplateBinding TitleTemplate}"
|
|
|
|
|
Focusable="False"
|
|
|
|
|
Grid.Row="1" />
|
|
|
|
|
|
|
|
|
|
<!-- Description -->
|
|
|
|
|
<ToggleButton
|
|
|
|
|
Grid.Row="2"
|
|
|
|
|
HorizontalAlignment="Right"
|
|
|
|
|
Margin="0,0,8,8"
|
2025-08-12 23:08:54 +08:00
|
|
|
Style="{StaticResource CodeSwitch}"
|
2025-07-31 20:12:01 +08:00
|
|
|
ToolTip="Show Code"
|
|
|
|
|
VerticalAlignment="Bottom"
|
|
|
|
|
x:Name="CodeSwitch">
|
|
|
|
|
<Path
|
|
|
|
|
Data="M1018.64495,531.297637 C1027.27952,512.687401 1023.24618,489.87879 1007.20328,475.433694 L802.095304,290.753647 L802.095304,290.753647 C782.394782,273.015217 752.044514,274.605807 734.306083,294.306329 L734.306083,294.306329 L734.306083,294.306329 C716.567653,314.006852 718.158243,344.35712 737.858766,362.09555 L904.138417,511.81442 L736.858766,662.433694 C717.158243,680.172125 715.567653,710.522392 733.306083,730.222915 C751.044514,749.923438 781.394782,751.514028 801.095304,733.775598 L1006.20328,549.09555 C1011.84552,544.015251 1016.00229,537.90046 1018.64495,531.297643 Z M119.947,511.390231 L286.22665,361.671361 C305.927173,343.932931 307.517763,313.582663 289.779333,293.88214 L289.779333,293.88214 L289.779333,293.88214 C272.040903,274.181618 241.690635,272.591027 221.990112,290.329458 L221.990112,290.329458 L16.8821402,475.009505 C0.839236202,489.454601 -3.19410198,512.263212 5.44046645,530.873448 C8.08312579,537.476271 12.2398959,543.591061 17.8821402,548.671361 L222.990112,733.351408 C242.690635,751.089839 273.040903,749.499248 290.779333,729.798726 C308.517763,710.098203 306.927173,679.747935 287.22665,662.009505 L119.947,511.390231 Z"
|
|
|
|
|
Fill="{Binding Path=Foreground, RelativeSource={RelativeSource AncestorType={x:Type ToggleButton}}}"
|
|
|
|
|
Height="16"
|
|
|
|
|
Stretch="Uniform"
|
|
|
|
|
Width="16"
|
|
|
|
|
x:Name="CodeSwitchPath" />
|
|
|
|
|
</ToggleButton>
|
|
|
|
|
<ContentControl
|
|
|
|
|
Content="{TemplateBinding Description}"
|
|
|
|
|
ContentTemplate="{TemplateBinding DescriptionTemplate}"
|
|
|
|
|
Focusable="False"
|
|
|
|
|
Grid.Row="2" />
|
|
|
|
|
<!-- Code -->
|
|
|
|
|
<ContentControl
|
|
|
|
|
Content="{TemplateBinding Code}"
|
|
|
|
|
ContentTemplate="{TemplateBinding CodeTemplate}"
|
|
|
|
|
Focusable="False"
|
|
|
|
|
Grid.Row="3"
|
|
|
|
|
Visibility="Collapsed"
|
|
|
|
|
x:Name="Code" />
|
|
|
|
|
</Grid>
|
|
|
|
|
<ControlTemplate.Triggers>
|
|
|
|
|
<Trigger Property="IsChecked" SourceName="CodeSwitch" Value="True">
|
|
|
|
|
<Setter Property="ToolTip" TargetName="CodeSwitch" Value="Hide Code" />
|
|
|
|
|
<Setter Property="Data" TargetName="CodeSwitchPath" Value="M1018.64495,531.297637 C1027.27952,512.687401 1023.24618,489.87879 1007.20328,475.433694 L802.095304,290.753647 C782.394782,273.015217 752.044514,274.605807 734.306083,294.306329 C716.567653,314.006852 718.158243,344.35712 737.858766,362.09555 L904.138417,511.81442 L736.858766,662.433694 C717.158243,680.172125 715.567653,710.522392 733.306083,730.222915 C751.044514,749.923438 781.394782,751.514028 801.095304,733.775598 L1006.20328,549.09555 C1011.84552,544.015251 1016.00229,537.90046 1018.64495,531.297643 Z M119.947,511.390231 L286.22665,361.671361 C305.927173,343.932931 307.517763,313.582663 289.779333,293.88214 C272.040903,274.181618 241.690635,272.591027 221.990112,290.329458 L16.8821402,475.009505 C0.839236202,489.454601 -3.19410198,512.263212 5.44046645,530.873448 C8.08312579,537.476271 12.2398959,543.591061 17.8821402,548.671361 L222.990112,733.351408 C242.690635,751.089839 273.040903,749.499248 290.779333,729.798726 C308.517763,710.098203 306.927173,679.747935 287.22665,662.009505 L119.947,511.390231 Z M649.492098,134.243566 C674.403037,143.310407 687.247217,170.85484 678.180377,195.765779 L436.030115,861.068155 C426.963275,885.979094 399.418842,898.823274 374.507902,889.756434 C349.596963,880.689593 336.752783,853.14516 345.819623,828.234221 L587.969885,162.931845 L587.969885,162.931845 C597.036725,138.020906 624.581158,125.176726 649.492098,134.243566 Z" />
|
|
|
|
|
<Setter Property="Visibility" TargetName="Code" Value="Visible" />
|
|
|
|
|
</Trigger>
|
|
|
|
|
</ControlTemplate.Triggers>
|
|
|
|
|
</ControlTemplate>
|
|
|
|
|
</Setter.Value>
|
|
|
|
|
</Setter>
|
|
|
|
|
<Setter Property="TitleTemplate">
|
|
|
|
|
<Setter.Value>
|
|
|
|
|
<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}}}" />
|
|
|
|
|
<TextBlock
|
2025-08-20 12:10:13 +08:00
|
|
|
Background="{DynamicResource ControlBackgroundNormalBrush}"
|
2025-07-31 20:12:01 +08:00
|
|
|
Canvas.Left="32"
|
|
|
|
|
Canvas.Top="-10"
|
|
|
|
|
FontWeight="Medium"
|
|
|
|
|
Padding="8,1"
|
|
|
|
|
Panel.ZIndex="1"
|
|
|
|
|
Text="{TemplateBinding Content}" />
|
|
|
|
|
</Canvas>
|
|
|
|
|
</DataTemplate>
|
|
|
|
|
</Setter.Value>
|
|
|
|
|
</Setter>
|
|
|
|
|
<Setter Property="DescriptionTemplate">
|
|
|
|
|
<Setter.Value>
|
|
|
|
|
<DataTemplate>
|
|
|
|
|
<ContentPresenter
|
2025-08-20 12:10:35 +08:00
|
|
|
Content="{Binding Content, RelativeSource={RelativeSource TemplatedParent}, Converter={x:Static internal:StringToMarkDownConverter.Instance}}"
|
2025-07-31 20:12:01 +08:00
|
|
|
Margin="32,18"
|
|
|
|
|
TextBlock.LineHeight="28" />
|
|
|
|
|
</DataTemplate>
|
|
|
|
|
</Setter.Value>
|
|
|
|
|
</Setter>
|
|
|
|
|
<Setter Property="CodeTemplate">
|
|
|
|
|
<Setter.Value>
|
|
|
|
|
<DataTemplate>
|
|
|
|
|
<Border
|
|
|
|
|
BorderBrush="{Binding BorderBrush, RelativeSource={RelativeSource AncestorType={x:Type controls:CodeBox}}}"
|
|
|
|
|
BorderThickness="0,1,0,0"
|
|
|
|
|
Padding="32,16"
|
|
|
|
|
Width="{Binding ActualWidth, RelativeSource={RelativeSource AncestorType={x:Type controls:CodeBox}}}">
|
2025-08-20 12:10:35 +08:00
|
|
|
<ContentPresenter Content="{Binding Content, RelativeSource={RelativeSource TemplatedParent}, Converter={x:Static internal:StringToCodeConverter.Instance}}" />
|
2025-07-31 20:12:01 +08:00
|
|
|
</Border>
|
|
|
|
|
</DataTemplate>
|
|
|
|
|
</Setter.Value>
|
|
|
|
|
</Setter>
|
|
|
|
|
</Style>
|
2025-08-12 23:08:54 +08:00
|
|
|
|
2025-07-31 20:12:24 +08:00
|
|
|
<!--<Style BasedOn="{StaticResource Antd.CodeBox}" TargetType="controls:CodeBox" />-->
|
|
|
|
|
|
2025-07-31 20:12:01 +08:00
|
|
|
</ResourceDictionary>
|