1224 lines
72 KiB
Plaintext
1224 lines
72 KiB
Plaintext
|
|
<ResourceDictionary
|
|||
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|||
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|||
|
|
xmlns:converter="clr-namespace:WpfAppTest.Converter"
|
|||
|
|
xmlns:local="clr-namespace:ModernWpf.Controls">
|
|||
|
|
<!-- 基础颜色 -->
|
|||
|
|
<SolidColorBrush x:Key="PrimaryHoverBrush" Color="#FF2EBD6B" />
|
|||
|
|
<SolidColorBrush x:Key="PrimaryPressedBrush" Color="#FF007A35" />
|
|||
|
|
<SolidColorBrush x:Key="DangerBrush" Color="#E81123" />
|
|||
|
|
<SolidColorBrush x:Key="DangerHoverBrush" Color="#FFB50F1C" />
|
|||
|
|
<SolidColorBrush x:Key="DangerPressedBrush" Color="#CC990000" />
|
|||
|
|
<SolidColorBrush x:Key="AlternalBrush" Color="#7D878787" />
|
|||
|
|
<SolidColorBrush x:Key="AccentTextBrush" Color="#FFEBEBEB" />
|
|||
|
|
<SolidColorBrush x:Key="TextPrimaryBrush" Color="#333333" />
|
|||
|
|
<SolidColorBrush x:Key="TextSecondBrush" Color="#FF888888" />
|
|||
|
|
|
|||
|
|
<!-- 基础颜色 -->
|
|||
|
|
<SolidColorBrush x:Key="PrimaryBrush" Color="#FF009943" />
|
|||
|
|
<SolidColorBrush x:Key="PrimaryLightBrush" Color="#FF2EBD6B" />
|
|||
|
|
<!-- 悬停色 -->
|
|||
|
|
<SolidColorBrush x:Key="PrimaryDarkBrush" Color="#FF007A35" />
|
|||
|
|
<SolidColorBrush x:Key="DangerColor" Color="#E81123" />
|
|||
|
|
<SolidColorBrush x:Key="PrimaryHover" Color="#FF2EBD6B" />
|
|||
|
|
|
|||
|
|
<!-- 按下色 -->
|
|||
|
|
<SolidColorBrush x:Key="TextBrush" Color="#333333" />
|
|||
|
|
<SolidColorBrush x:Key="LightTextBrush" Color="#999999" />
|
|||
|
|
<SolidColorBrush x:Key="BorderBrush" Color="#DDDDDD" />
|
|||
|
|
<SolidColorBrush x:Key="BackgroundBrush" Color="#FFFFFF" />
|
|||
|
|
<FontFamily x:Key="SJQY">pack://application:,,,/WpfAppTest;component/Fonts/#SJQY</FontFamily>
|
|||
|
|
<!-- 基础转换器 (需要自己在C#实现BooleanToVisibilityConverter等,这里省略) -->
|
|||
|
|
<BooleanToVisibilityConverter x:Key="BoolToVis" />
|
|||
|
|
<converter:NullToBooleanConverter x:Key="NullToBooleanConverter" />
|
|||
|
|
<converter:NullableToVisibilityConverter x:Key="NotNullToVisibilityConverter" />
|
|||
|
|
<DrawingImage x:Key="Logo">
|
|||
|
|
<DrawingImage.Drawing>
|
|||
|
|
<DrawingGroup ClipGeometry="M0,0 V1024 H1024 V0 H0 Z">
|
|||
|
|
<DrawingGroup.Transform>
|
|||
|
|
<TranslateTransform X="0" Y="5.8161029301118106E-05" />
|
|||
|
|
</DrawingGroup.Transform>
|
|||
|
|
<GeometryDrawing Brush="WhiteSmoke" Geometry="F1 M1024,1024z M0,0z M510.165334,556.416195C494.378674,556.416195,478.805347,557.226861,463.402687,558.762861L463.402687,465.280233A476.287802,476.287802,0,0,0,556.927981,465.280233L556.927981,558.720194C541.567987,557.226861,525.909327,556.416195,510.122667,556.416195z M701.823921,597.418844L701.823921,426.581582A467.626472,467.626472,0,0,0,977.621139,1.877759A1.877333,1.877333,0,0,0,975.743807,0.000427L834.517199,0.000427A1.877333,1.877333,0,0,0,832.7252,1.877759A322.133199,322.133199,0,0,1,701.866588,259.498985L701.866588,1.877759A1.877333,1.877333,0,0,0,699.946588,0.000427L558.719981,0.000427A1.877333,1.877333,0,0,0,556.885315,1.877759L556.885315,319.232294A324.309198,324.309198,0,0,1,463.36002,319.232294L463.36002,1.920426A1.834666,1.834666,0,0,0,461.568021,0.000427L320.341413,0.000427A1.877333,1.877333,0,0,0,318.506747,1.877759L318.506747,259.541652A322.133199,322.133199,0,0,1,187.562802,1.835093A1.877333,1.877333,0,0,0,185.728136,0.000427L44.544195,0.000427A1.877333,1.877333,0,0,0,42.666862,1.877759A467.626472,467.626472,0,0,0,318.506747,426.666916L318.506747,597.333511A467.626472,467.626472,0,0,0,42.666862,1022.122667C42.666862,1023.146667,43.520195,1024,44.544195,1024L185.770803,1024C186.752136,1024,187.562802,1023.146667,187.562802,1022.122667A322.133199,322.133199,0,0,1,318.549414,764.458775L318.549414,1022.122667C318.549414,1023.146667,319.36008,1024,320.38408,1024L461.568021,1024C462.592021,1024,463.402687,1023.146667,463.402687,1022.122667L463.402687,704.725466A325.717198,325.717198,0,0,1,556.927981,704.725466L556.927981,1022.122667C556.927981,1023.146667,557.781314,1024,558.805314,1024L699.989255,1024C701.013255,1024,701.823921,1023.146667,701.823921,1022.122667L701.823921,764.501441A322.133199,322.133199,0,0,1,832.7252,1022.122667C832.7252,1023.189333,833.535866,1024,834.559866,1024L975.743807,1024C976.767807,1024,977.62114,1023.146667,977.621139,1022.122667A467.626472,467.626472,0,0,0,701.866588,597.418844z" />
|
|||
|
|
</DrawingGroup>
|
|||
|
|
</DrawingImage.Drawing>
|
|||
|
|
</DrawingImage>
|
|||
|
|
<!-- 现代感“显示密码”图标 (睁眼) -->
|
|||
|
|
<Geometry x:Key="IconEyeOpen">
|
|||
|
|
M12,4.5C7,4.5 2.73,7.61 1,12C2.73,16.39 7,19.5 12,19.5C17,19.5 21.27,16.39 23,12C21.27,7.61 17,4.5 12,4.5M12,17A5,5 0 0,1 7,12A5,5 0 0,1 12,7A5,5 0 0,1 17,12A5,5 0 0,1 12,17M12,9A3,3 0 0,0 9,12A3,3 0 0,0 12,15A3,3 0 0,0 15,12A3,3 0 0,0 12,9Z
|
|||
|
|
</Geometry>
|
|||
|
|
|
|||
|
|
<!-- 现代感“隐藏密码”图标 (闭眼/带斜杠) -->
|
|||
|
|
<Geometry x:Key="IconEyeClosed">
|
|||
|
|
M2,4.27L3.27,3L3.53,3.27L20.73,20.47L20.47,20.73L19.2,22L15.73,18.53C14.6,19.15 13.35,19.5 12,19.5C7,19.5 2.73,16.39 1,12C1.69,10.24 2.82,8.69 4.2,7.46L2,4.27M12,9A3,3 0 0,1 15,12C15,12.35 14.94,12.69 14.83,13L11,9.17C11.31,9.06 11.65,9 12,9M7,12A5,5 0 0,0 12,17C12.55,17 13.06,16.91 13.55,16.74L11.77,14.96C11.84,14.97 11.92,15 12,15A3,3 0 0,1 9,12C9,11.92 9.03,11.84 9.04,11.77L7.26,10C7.09,10.49 7,11 7,12Z
|
|||
|
|
</Geometry>
|
|||
|
|
<!-- 用户图标 -->
|
|||
|
|
<Geometry x:Key="IconUser">
|
|||
|
|
M12,4A4,4 0 0,1 16,8A4,4 0 0,1 12,12A4,4 0 0,1 8,8A4,4 0 0,1 12,4M12,14C16.42,14 20,15.79 20,18V20H4V18C4,15.79 7.58,14 12,14Z
|
|||
|
|
</Geometry>
|
|||
|
|
|
|||
|
|
<!-- 锁/密码图标 -->
|
|||
|
|
<Geometry x:Key="IconLock">
|
|||
|
|
M12,17A2,2 0 0,0 14,15C14,13.89 13.11,13 12,13A2,2 0 0,0 10,15C10,16.11 10.89,17 12,17M18,8H17V6A5,5 0 0,0 7,6V8H6A2,2 0 0,0 4,10V20A2,2 0 0,0 6,22H18A2,2 0 0,0 20,20V10A2,2 0 0,0 18,8M9,6A3,3 0 0,1 12,3A3,3 0 0,1 15,6V8H9V6Z
|
|||
|
|
</Geometry>
|
|||
|
|
|
|||
|
|
<!-- 下拉箭头图标 -->
|
|||
|
|
<Geometry x:Key="IconChevronDown">
|
|||
|
|
M7,10L12,15L17,10
|
|||
|
|
</Geometry>
|
|||
|
|
<Style x:Key="WindowControlButtonStyle" TargetType="Button">
|
|||
|
|
<Setter Property="Width" Value="46" />
|
|||
|
|
<Setter Property="Height" Value="32" />
|
|||
|
|
<!-- 高度从 40 改为 32 -->
|
|||
|
|
<Setter Property="Background" Value="Transparent" />
|
|||
|
|
<Setter Property="BorderThickness" Value="0" />
|
|||
|
|
<Setter Property="Foreground" Value="White" />
|
|||
|
|
<Setter Property="WindowChrome.IsHitTestVisibleInChrome" Value="True" />
|
|||
|
|
<Setter Property="Template">
|
|||
|
|
<Setter.Value>
|
|||
|
|
<ControlTemplate TargetType="Button">
|
|||
|
|
<Border x:Name="border" Background="{TemplateBinding Background}">
|
|||
|
|
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
|
|||
|
|
</Border>
|
|||
|
|
<ControlTemplate.Triggers>
|
|||
|
|
<Trigger Property="IsMouseOver" Value="True">
|
|||
|
|
<Setter TargetName="border" Property="Background" Value="#44FFFFFF" />
|
|||
|
|
</Trigger>
|
|||
|
|
<Trigger Property="IsPressed" Value="True">
|
|||
|
|
<Setter TargetName="border" Property="Background" Value="#22FFFFFF" />
|
|||
|
|
</Trigger>
|
|||
|
|
</ControlTemplate.Triggers>
|
|||
|
|
</ControlTemplate>
|
|||
|
|
</Setter.Value>
|
|||
|
|
</Setter>
|
|||
|
|
</Style>
|
|||
|
|
|
|||
|
|
<!-- 专用关闭按钮样式 (避免 Trigger 冲突) -->
|
|||
|
|
<Style
|
|||
|
|
x:Key="WindowCloseButtonStyle"
|
|||
|
|
BasedOn="{StaticResource WindowControlButtonStyle}"
|
|||
|
|
TargetType="Button">
|
|||
|
|
<Setter Property="Template">
|
|||
|
|
<Setter.Value>
|
|||
|
|
<ControlTemplate TargetType="Button">
|
|||
|
|
<Border x:Name="border" Background="{TemplateBinding Background}">
|
|||
|
|
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
|
|||
|
|
</Border>
|
|||
|
|
<ControlTemplate.Triggers>
|
|||
|
|
<!-- 这里直接指定悬停为 DangerColor -->
|
|||
|
|
<Trigger Property="IsMouseOver" Value="True">
|
|||
|
|
<Setter TargetName="border" Property="Background" Value="{StaticResource DangerColor}" />
|
|||
|
|
<Setter Property="Foreground" Value="White" />
|
|||
|
|
</Trigger>
|
|||
|
|
<Trigger Property="IsPressed" Value="True">
|
|||
|
|
<Setter TargetName="border" Property="Background" Value="#CC990000" />
|
|||
|
|
</Trigger>
|
|||
|
|
</ControlTemplate.Triggers>
|
|||
|
|
</ControlTemplate>
|
|||
|
|
</Setter.Value>
|
|||
|
|
</Setter>
|
|||
|
|
</Style>
|
|||
|
|
|
|||
|
|
<!-- ModernWindow Style (应用新的关闭按钮样式) -->
|
|||
|
|
<Style x:Key="ModernWindowStyle" TargetType="{x:Type local:ModernWindow}">
|
|||
|
|
<Setter Property="Background" Value="White" />
|
|||
|
|
<Setter Property="Template">
|
|||
|
|
<Setter.Value>
|
|||
|
|
<ControlTemplate TargetType="{x:Type local:ModernWindow}">
|
|||
|
|
<Border
|
|||
|
|
x:Name="WindowBorder"
|
|||
|
|
Background="White"
|
|||
|
|
BorderBrush="{StaticResource PrimaryBrush}"
|
|||
|
|
BorderThickness="1">
|
|||
|
|
<Border.Style>
|
|||
|
|
<Style TargetType="{x:Type Border}">
|
|||
|
|
<Style.Triggers>
|
|||
|
|
<DataTrigger Binding="{Binding Path=WindowState, RelativeSource={RelativeSource TemplatedParent}}" Value="Normal">
|
|||
|
|
<Setter Property="Padding" Value="0" />
|
|||
|
|
</DataTrigger>
|
|||
|
|
<DataTrigger Binding="{Binding Path=WindowState, RelativeSource={RelativeSource TemplatedParent}}" Value="Maximized">
|
|||
|
|
<Setter Property="Padding" Value="8" />
|
|||
|
|
</DataTrigger>
|
|||
|
|
</Style.Triggers>
|
|||
|
|
</Style>
|
|||
|
|
</Border.Style>
|
|||
|
|
<Grid>
|
|||
|
|
<Grid.RowDefinitions>
|
|||
|
|
<RowDefinition Height="32" />
|
|||
|
|
<RowDefinition Height="*" />
|
|||
|
|
</Grid.RowDefinitions>
|
|||
|
|
|
|||
|
|
<!-- 标题栏 -->
|
|||
|
|
<Border
|
|||
|
|
x:Name="PART_TitleBar"
|
|||
|
|
Grid.Row="0"
|
|||
|
|
Background="{StaticResource PrimaryBrush}">
|
|||
|
|
<Grid>
|
|||
|
|
<Grid.ColumnDefinitions>
|
|||
|
|
<ColumnDefinition Width="Auto" />
|
|||
|
|
<ColumnDefinition Width="*" />
|
|||
|
|
<ColumnDefinition Width="Auto" />
|
|||
|
|
</Grid.ColumnDefinitions>
|
|||
|
|
|
|||
|
|
<Image
|
|||
|
|
Width="18"
|
|||
|
|
Height="18"
|
|||
|
|
Margin="10,0,5,0"
|
|||
|
|
VerticalAlignment="Center"
|
|||
|
|
Source="{TemplateBinding Icon}">
|
|||
|
|
<Image.Style>
|
|||
|
|
<Style TargetType="Image">
|
|||
|
|
<Style.Triggers>
|
|||
|
|
<Trigger Property="Source" Value="{x:Null}">
|
|||
|
|
<Setter Property="Visibility" Value="Collapsed" />
|
|||
|
|
</Trigger>
|
|||
|
|
</Style.Triggers>
|
|||
|
|
</Style>
|
|||
|
|
</Image.Style>
|
|||
|
|
</Image>
|
|||
|
|
|
|||
|
|
<TextBlock
|
|||
|
|
Grid.Column="1"
|
|||
|
|
Margin="10,0"
|
|||
|
|
VerticalAlignment="Center"
|
|||
|
|
FontSize="12"
|
|||
|
|
FontWeight="SemiBold"
|
|||
|
|
Foreground="White"
|
|||
|
|
Text="{TemplateBinding Title}" />
|
|||
|
|
|
|||
|
|
<StackPanel
|
|||
|
|
Grid.Column="2"
|
|||
|
|
VerticalAlignment="Top"
|
|||
|
|
Orientation="Horizontal">
|
|||
|
|
<!-- 强制靠上对齐 -->
|
|||
|
|
<Button Command="{Binding Source={x:Static SystemCommands.MinimizeWindowCommand}}" Style="{StaticResource WindowControlButtonStyle}">
|
|||
|
|
<Path
|
|||
|
|
Width="10"
|
|||
|
|
Data="M0,0 H10"
|
|||
|
|
Stroke="White"
|
|||
|
|
StrokeThickness="1" />
|
|||
|
|
</Button>
|
|||
|
|
<Button x:Name="RestoreButton" Style="{StaticResource WindowControlButtonStyle}">
|
|||
|
|
<Path
|
|||
|
|
x:Name="RestorePath"
|
|||
|
|
Width="10"
|
|||
|
|
Height="10"
|
|||
|
|
Data="M1,1 H9 V9 H1 Z"
|
|||
|
|
Stroke="White"
|
|||
|
|
StrokeThickness="1" />
|
|||
|
|
</Button>
|
|||
|
|
<Button
|
|||
|
|
x:Name="CloseBtn"
|
|||
|
|
Command="{Binding Source={x:Static SystemCommands.CloseWindowCommand}}"
|
|||
|
|
Style="{StaticResource WindowCloseButtonStyle}">
|
|||
|
|
<Path
|
|||
|
|
Width="10"
|
|||
|
|
Height="10"
|
|||
|
|
Data="M0,0 L10,10 M0,10 L10,0"
|
|||
|
|
Stroke="White"
|
|||
|
|
StrokeThickness="1" />
|
|||
|
|
</Button>
|
|||
|
|
</StackPanel>
|
|||
|
|
</Grid>
|
|||
|
|
</Border>
|
|||
|
|
<ContentPresenter Grid.Row="1" />
|
|||
|
|
</Grid>
|
|||
|
|
</Border>
|
|||
|
|
<ControlTemplate.Triggers>
|
|||
|
|
<!-- 状态:普通 -->
|
|||
|
|
<Trigger Property="WindowState" Value="Normal">
|
|||
|
|
<Setter TargetName="RestoreButton" Property="Command" Value="{Binding Source={x:Static SystemCommands.MaximizeWindowCommand}}" />
|
|||
|
|
</Trigger>
|
|||
|
|
|
|||
|
|
<!-- 状态:最大化 -->
|
|||
|
|
<Trigger Property="WindowState" Value="Maximized">
|
|||
|
|
<!-- 核心:修复最大化时按钮偏移偏上的问题 -->
|
|||
|
|
<Setter TargetName="WindowBorder" Property="Margin" Value="{Binding Source={x:Static SystemParameters.WindowNonClientFrameThickness}}" />
|
|||
|
|
<Setter TargetName="WindowBorder" Property="BorderThickness" Value="0" />
|
|||
|
|
<Setter TargetName="RestoreButton" Property="Command" Value="{Binding Source={x:Static SystemCommands.RestoreWindowCommand}}" />
|
|||
|
|
<Setter TargetName="RestorePath" Property="Data" Value="M1,3 H7 V9 H1 Z M3,3 V1 H9 V7 H7" />
|
|||
|
|
</Trigger>
|
|||
|
|
</ControlTemplate.Triggers>
|
|||
|
|
</ControlTemplate>
|
|||
|
|
</Setter.Value>
|
|||
|
|
</Setter>
|
|||
|
|
</Style>
|
|||
|
|
|
|||
|
|
<!-- ============================================== -->
|
|||
|
|
<!-- 2. TextBox Style (新增 Prefix 支持) -->
|
|||
|
|
<!-- ============================================== -->
|
|||
|
|
<Style TargetType="TextBox">
|
|||
|
|
<Setter Property="local:ElementHelper.CornerRadius" Value="4" />
|
|||
|
|
<Setter Property="Padding" Value="8,0" />
|
|||
|
|
<Setter Property="Height" Value="36" />
|
|||
|
|
<Setter Property="VerticalContentAlignment" Value="Center" />
|
|||
|
|
<Setter Property="BorderBrush" Value="{StaticResource BorderBrush}" />
|
|||
|
|
<Setter Property="Template">
|
|||
|
|
<Setter.Value>
|
|||
|
|
<ControlTemplate TargetType="TextBox">
|
|||
|
|
<Border
|
|||
|
|
x:Name="border"
|
|||
|
|
Height="{TemplateBinding Height}"
|
|||
|
|
Background="{TemplateBinding Background}"
|
|||
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
|||
|
|
BorderThickness="1"
|
|||
|
|
CornerRadius="{Binding Path=(local:ElementHelper.CornerRadius), RelativeSource={RelativeSource TemplatedParent}}">
|
|||
|
|
<Grid>
|
|||
|
|
<Grid.ColumnDefinitions>
|
|||
|
|
<ColumnDefinition Width="Auto" />
|
|||
|
|
<!-- For Prefix -->
|
|||
|
|
<ColumnDefinition Width="*" />
|
|||
|
|
</Grid.ColumnDefinitions>
|
|||
|
|
|
|||
|
|
<!-- Prefix 呈现器 -->
|
|||
|
|
<ContentPresenter
|
|||
|
|
Grid.Column="0"
|
|||
|
|
Margin="4,0,0,0"
|
|||
|
|
VerticalAlignment="Center"
|
|||
|
|
Content="{Binding Path=(local:ElementHelper.Prefix), RelativeSource={RelativeSource TemplatedParent}}"
|
|||
|
|
TextElement.Foreground="{StaticResource LightTextBrush}"
|
|||
|
|
Visibility="{Binding Path=(local:ElementHelper.Prefix), RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource NotNullToVisibilityConverter}}" />
|
|||
|
|
|
|||
|
|
<Grid Grid.Column="1">
|
|||
|
|
<TextBlock
|
|||
|
|
x:Name="Watermark"
|
|||
|
|
Margin="{TemplateBinding Padding}"
|
|||
|
|
Padding="2,0,0,0"
|
|||
|
|
VerticalAlignment="Center"
|
|||
|
|
Foreground="{StaticResource LightTextBrush}"
|
|||
|
|
IsHitTestVisible="False"
|
|||
|
|
Text="{Binding Path=(local:ElementHelper.Watermark), RelativeSource={RelativeSource TemplatedParent}}"
|
|||
|
|
Visibility="Collapsed" />
|
|||
|
|
<ScrollViewer
|
|||
|
|
x:Name="PART_ContentHost"
|
|||
|
|
Margin="0"
|
|||
|
|
VerticalAlignment="Center" />
|
|||
|
|
</Grid>
|
|||
|
|
</Grid>
|
|||
|
|
</Border>
|
|||
|
|
<ControlTemplate.Triggers>
|
|||
|
|
<Trigger Property="Text" Value="">
|
|||
|
|
<Setter TargetName="Watermark" Property="Visibility" Value="Visible" />
|
|||
|
|
</Trigger>
|
|||
|
|
<Trigger Property="IsFocused" Value="True">
|
|||
|
|
<Setter TargetName="border" Property="BorderBrush" Value="{StaticResource PrimaryBrush}" />
|
|||
|
|
</Trigger>
|
|||
|
|
</ControlTemplate.Triggers>
|
|||
|
|
</ControlTemplate>
|
|||
|
|
</Setter.Value>
|
|||
|
|
</Setter>
|
|||
|
|
</Style>
|
|||
|
|
|
|||
|
|
<Style TargetType="{x:Type local:ModernPasswordBox}">
|
|||
|
|
<Setter Property="Height" Value="36" />
|
|||
|
|
<Setter Property="Padding" Value="8,0" />
|
|||
|
|
<Setter Property="Template">
|
|||
|
|
<Setter.Value>
|
|||
|
|
<ControlTemplate TargetType="{x:Type local:ModernPasswordBox}">
|
|||
|
|
<Border
|
|||
|
|
x:Name="MainBorder"
|
|||
|
|
Background="White"
|
|||
|
|
BorderBrush="{StaticResource BorderBrush}"
|
|||
|
|
BorderThickness="1"
|
|||
|
|
CornerRadius="4">
|
|||
|
|
<Grid>
|
|||
|
|
<Grid.ColumnDefinitions>
|
|||
|
|
<ColumnDefinition Width="Auto" />
|
|||
|
|
<!-- Prefix -->
|
|||
|
|
<ColumnDefinition Width="*" />
|
|||
|
|
<ColumnDefinition Width="36" />
|
|||
|
|
<!-- ToggleBtn -->
|
|||
|
|
</Grid.ColumnDefinitions>
|
|||
|
|
|
|||
|
|
<!-- Prefix -->
|
|||
|
|
<ContentPresenter
|
|||
|
|
Grid.Column="0"
|
|||
|
|
Margin="4,0,0,0"
|
|||
|
|
VerticalAlignment="Center"
|
|||
|
|
Content="{Binding Path=(local:ElementHelper.Prefix), RelativeSource={RelativeSource TemplatedParent}}"
|
|||
|
|
TextElement.Foreground="{StaticResource LightTextBrush}" />
|
|||
|
|
|
|||
|
|
<Grid Grid.Column="1">
|
|||
|
|
<!-- 水印文本块 -->
|
|||
|
|
<TextBlock
|
|||
|
|
x:Name="Watermark"
|
|||
|
|
Margin="8,0"
|
|||
|
|
Padding="2,0,0,0"
|
|||
|
|
VerticalAlignment="Center"
|
|||
|
|
Foreground="#AAA"
|
|||
|
|
IsHitTestVisible="False"
|
|||
|
|
Text="{Binding Path=(local:ElementHelper.Watermark), RelativeSource={RelativeSource TemplatedParent}}"
|
|||
|
|
Visibility="Collapsed" />
|
|||
|
|
|
|||
|
|
<PasswordBox
|
|||
|
|
x:Name="PART_PasswordBox"
|
|||
|
|
Padding="8,0"
|
|||
|
|
VerticalContentAlignment="Center"
|
|||
|
|
Background="Transparent"
|
|||
|
|
BorderThickness="0" />
|
|||
|
|
<TextBox
|
|||
|
|
x:Name="PART_TextBox"
|
|||
|
|
Padding="8,0"
|
|||
|
|
VerticalContentAlignment="Center"
|
|||
|
|
Background="Transparent"
|
|||
|
|
BorderThickness="0"
|
|||
|
|
Style="{x:Null}"
|
|||
|
|
Visibility="Collapsed" />
|
|||
|
|
</Grid>
|
|||
|
|
|
|||
|
|
<ToggleButton
|
|||
|
|
x:Name="PART_ToggleBtn"
|
|||
|
|
Grid.Column="2"
|
|||
|
|
Background="Transparent"
|
|||
|
|
BorderThickness="0"
|
|||
|
|
Cursor="Hand">
|
|||
|
|
<ToggleButton.Template>
|
|||
|
|
<ControlTemplate TargetType="ToggleButton">
|
|||
|
|
<Border Background="Transparent">
|
|||
|
|
<Path
|
|||
|
|
x:Name="IconPath"
|
|||
|
|
Width="18"
|
|||
|
|
Data="{StaticResource IconEyeOpen}"
|
|||
|
|
Fill="{StaticResource LightTextBrush}"
|
|||
|
|
Stretch="Uniform" />
|
|||
|
|
</Border>
|
|||
|
|
<ControlTemplate.Triggers>
|
|||
|
|
<!-- 鼠标悬停时图标变深 -->
|
|||
|
|
<Trigger Property="IsMouseOver" Value="True">
|
|||
|
|
<Setter TargetName="IconPath" Property="Fill" Value="{StaticResource PrimaryBrush}" />
|
|||
|
|
</Trigger>
|
|||
|
|
<!-- 选中状态 (显示明文) -->
|
|||
|
|
<Trigger Property="IsChecked" Value="True">
|
|||
|
|
<Setter TargetName="IconPath" Property="Data" Value="{StaticResource IconEyeClosed}" />
|
|||
|
|
</Trigger>
|
|||
|
|
</ControlTemplate.Triggers>
|
|||
|
|
</ControlTemplate>
|
|||
|
|
</ToggleButton.Template>
|
|||
|
|
</ToggleButton>
|
|||
|
|
</Grid>
|
|||
|
|
</Border>
|
|||
|
|
<ControlTemplate.Triggers>
|
|||
|
|
<!-- 当密码为空时显示水印 -->
|
|||
|
|
<Trigger Property="IsEmpty" Value="True">
|
|||
|
|
<Setter TargetName="Watermark" Property="Visibility" Value="Visible" />
|
|||
|
|
</Trigger>
|
|||
|
|
<Trigger Property="IsMouseOver" Value="True">
|
|||
|
|
<Setter TargetName="MainBorder" Property="BorderBrush" Value="{StaticResource PrimaryBrush}" />
|
|||
|
|
</Trigger>
|
|||
|
|
</ControlTemplate.Triggers>
|
|||
|
|
</ControlTemplate>
|
|||
|
|
</Setter.Value>
|
|||
|
|
</Setter>
|
|||
|
|
</Style>
|
|||
|
|
|
|||
|
|
<Style TargetType="Button">
|
|||
|
|
<Setter Property="Height" Value="36" />
|
|||
|
|
<Setter Property="Padding" Value="15,0" />
|
|||
|
|
<Setter Property="Background" Value="{StaticResource PrimaryBrush}" />
|
|||
|
|
<Setter Property="Foreground" Value="White" />
|
|||
|
|
<Setter Property="Template">
|
|||
|
|
<Setter.Value>
|
|||
|
|
<ControlTemplate TargetType="Button">
|
|||
|
|
<Border
|
|||
|
|
x:Name="btnBorder"
|
|||
|
|
Background="{TemplateBinding Background}"
|
|||
|
|
CornerRadius="4">
|
|||
|
|
<Grid
|
|||
|
|
Margin="{TemplateBinding Padding}"
|
|||
|
|
HorizontalAlignment="Center"
|
|||
|
|
VerticalAlignment="Center">
|
|||
|
|
<Grid.ColumnDefinitions>
|
|||
|
|
<ColumnDefinition Width="Auto" />
|
|||
|
|
<ColumnDefinition Width="*" />
|
|||
|
|
</Grid.ColumnDefinitions>
|
|||
|
|
<Viewbox
|
|||
|
|
Grid.Column="0"
|
|||
|
|
Width="16"
|
|||
|
|
Height="16"
|
|||
|
|
Margin="0,0,5,0"
|
|||
|
|
Visibility="{Binding Path=(local:ElementHelper.Icon), RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource NotNullToVisibilityConverter}}">
|
|||
|
|
<Path Data="{Binding Path=(local:ElementHelper.Icon), RelativeSource={RelativeSource TemplatedParent}}" Stroke="White" />
|
|||
|
|
</Viewbox>
|
|||
|
|
<ContentPresenter Grid.Column="1" />
|
|||
|
|
</Grid>
|
|||
|
|
</Border>
|
|||
|
|
<ControlTemplate.Triggers>
|
|||
|
|
<Trigger Property="IsMouseOver" Value="True">
|
|||
|
|
<Setter TargetName="btnBorder" Property="Background" Value="{StaticResource PrimaryHover}" />
|
|||
|
|
</Trigger>
|
|||
|
|
</ControlTemplate.Triggers>
|
|||
|
|
</ControlTemplate>
|
|||
|
|
</Setter.Value>
|
|||
|
|
</Setter>
|
|||
|
|
</Style>
|
|||
|
|
|
|||
|
|
<Style TargetType="ComboBoxItem">
|
|||
|
|
<Setter Property="SnapsToDevicePixels" Value="True" />
|
|||
|
|
<Setter Property="Padding" Value="10,8" />
|
|||
|
|
<Setter Property="HorizontalContentAlignment" Value="Left" />
|
|||
|
|
<Setter Property="VerticalContentAlignment" Value="Center" />
|
|||
|
|
<Setter Property="Background" Value="Transparent" />
|
|||
|
|
<Setter Property="BorderThickness" Value="0" />
|
|||
|
|
<Setter Property="Template">
|
|||
|
|
<Setter.Value>
|
|||
|
|
<ControlTemplate TargetType="ComboBoxItem">
|
|||
|
|
<Border
|
|||
|
|
x:Name="Bd"
|
|||
|
|
Padding="{TemplateBinding Padding}"
|
|||
|
|
Background="{TemplateBinding Background}"
|
|||
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
|||
|
|
BorderThickness="{TemplateBinding BorderThickness}"
|
|||
|
|
SnapsToDevicePixels="true">
|
|||
|
|
<ContentPresenter
|
|||
|
|
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
|||
|
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
|||
|
|
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
|
|||
|
|
</Border>
|
|||
|
|
<ControlTemplate.Triggers>
|
|||
|
|
<Trigger Property="IsMouseOver" Value="True">
|
|||
|
|
<Setter TargetName="Bd" Property="Background" Value="#F2F2F2" />
|
|||
|
|
<Setter Property="Foreground" Value="{StaticResource PrimaryBrush}" />
|
|||
|
|
</Trigger>
|
|||
|
|
<Trigger Property="IsSelected" Value="True">
|
|||
|
|
<Setter TargetName="Bd" Property="Background" Value="{StaticResource PrimaryBrush}" />
|
|||
|
|
<Setter Property="Foreground" Value="White" />
|
|||
|
|
</Trigger>
|
|||
|
|
</ControlTemplate.Triggers>
|
|||
|
|
</ControlTemplate>
|
|||
|
|
</Setter.Value>
|
|||
|
|
</Setter>
|
|||
|
|
</Style>
|
|||
|
|
|
|||
|
|
<Style TargetType="{x:Type local:SearchableComboBox}">
|
|||
|
|
<Setter Property="SnapsToDevicePixels" Value="True" />
|
|||
|
|
<Setter Property="Height" Value="36" />
|
|||
|
|
<Setter Property="Padding" Value="8,0" />
|
|||
|
|
<Setter Property="Background" Value="White" />
|
|||
|
|
<Setter Property="local:ElementHelper.CornerRadius" Value="4" />
|
|||
|
|
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto" />
|
|||
|
|
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
|
|||
|
|
<Setter Property="ScrollViewer.CanContentScroll" Value="true" />
|
|||
|
|
<Setter Property="Template">
|
|||
|
|
<Setter.Value>
|
|||
|
|
<ControlTemplate TargetType="{x:Type local:SearchableComboBox}">
|
|||
|
|
<Grid>
|
|||
|
|
<!-- 下拉开关 (箭头) -->
|
|||
|
|
<ToggleButton
|
|||
|
|
Name="ToggleButton"
|
|||
|
|
Background="Transparent"
|
|||
|
|
ClickMode="Press"
|
|||
|
|
Focusable="false"
|
|||
|
|
IsChecked="{Binding Path=IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}">
|
|||
|
|
<ToggleButton.Template>
|
|||
|
|
<ControlTemplate TargetType="ToggleButton">
|
|||
|
|
<Border
|
|||
|
|
x:Name="Border"
|
|||
|
|
Background="{TemplateBinding Background}"
|
|||
|
|
BorderBrush="{StaticResource BorderBrush}"
|
|||
|
|
BorderThickness="1"
|
|||
|
|
CornerRadius="{Binding Path=(local:ElementHelper.CornerRadius), RelativeSource={RelativeSource AncestorType=local:SearchableComboBox}}">
|
|||
|
|
<Grid>
|
|||
|
|
<Grid.ColumnDefinitions>
|
|||
|
|
<ColumnDefinition />
|
|||
|
|
<ColumnDefinition Width="30" />
|
|||
|
|
</Grid.ColumnDefinitions>
|
|||
|
|
<Path
|
|||
|
|
x:Name="ArrowPath"
|
|||
|
|
Grid.Column="1"
|
|||
|
|
Width="10"
|
|||
|
|
Height="6"
|
|||
|
|
HorizontalAlignment="Center"
|
|||
|
|
VerticalAlignment="Center"
|
|||
|
|
Data="{StaticResource IconChevronDown}"
|
|||
|
|
RenderTransformOrigin="0.5,0.5"
|
|||
|
|
Stretch="Uniform"
|
|||
|
|
Stroke="{StaticResource TextBrush}"
|
|||
|
|
StrokeThickness="1.5">
|
|||
|
|
<Path.RenderTransform>
|
|||
|
|
<RotateTransform Angle="0" />
|
|||
|
|
</Path.RenderTransform>
|
|||
|
|
</Path>
|
|||
|
|
</Grid>
|
|||
|
|
</Border>
|
|||
|
|
<ControlTemplate.Triggers>
|
|||
|
|
<Trigger Property="IsMouseOver" Value="True">
|
|||
|
|
<Setter TargetName="Border" Property="BorderBrush" Value="{StaticResource PrimaryBrush}" />
|
|||
|
|
</Trigger>
|
|||
|
|
<!-- 箭头旋转动画 -->
|
|||
|
|
<Trigger Property="IsChecked" Value="True">
|
|||
|
|
<Trigger.EnterActions>
|
|||
|
|
<BeginStoryboard>
|
|||
|
|
<Storyboard>
|
|||
|
|
<DoubleAnimation
|
|||
|
|
Storyboard.TargetName="ArrowPath"
|
|||
|
|
Storyboard.TargetProperty="(UIElement.RenderTransform).(RotateTransform.Angle)"
|
|||
|
|
To="180"
|
|||
|
|
Duration="0:0:0.2" />
|
|||
|
|
</Storyboard>
|
|||
|
|
</BeginStoryboard>
|
|||
|
|
</Trigger.EnterActions>
|
|||
|
|
<Trigger.ExitActions>
|
|||
|
|
<BeginStoryboard>
|
|||
|
|
<Storyboard>
|
|||
|
|
<DoubleAnimation
|
|||
|
|
Storyboard.TargetName="ArrowPath"
|
|||
|
|
Storyboard.TargetProperty="(UIElement.RenderTransform).(RotateTransform.Angle)"
|
|||
|
|
To="0"
|
|||
|
|
Duration="0:0:0.2" />
|
|||
|
|
</Storyboard>
|
|||
|
|
</BeginStoryboard>
|
|||
|
|
</Trigger.ExitActions>
|
|||
|
|
</Trigger>
|
|||
|
|
</ControlTemplate.Triggers>
|
|||
|
|
</ControlTemplate>
|
|||
|
|
</ToggleButton.Template>
|
|||
|
|
</ToggleButton>
|
|||
|
|
|
|||
|
|
<!-- 输入框 (必须命名为 PART_EditableTextBox) -->
|
|||
|
|
<TextBox
|
|||
|
|
x:Name="PART_EditableTextBox"
|
|||
|
|
Margin="5,1,30,1"
|
|||
|
|
Padding="{TemplateBinding Padding}"
|
|||
|
|
HorizontalAlignment="Left"
|
|||
|
|
VerticalAlignment="Center"
|
|||
|
|
Background="Transparent"
|
|||
|
|
BorderThickness="0"
|
|||
|
|
Focusable="True"
|
|||
|
|
Style="{x:Null}"
|
|||
|
|
Text="{Binding Path=Text, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
|
|||
|
|
|
|||
|
|
<!-- 水印 -->
|
|||
|
|
<TextBlock
|
|||
|
|
Margin="7,0,0,0"
|
|||
|
|
Padding="{TemplateBinding Padding}"
|
|||
|
|
VerticalAlignment="Center"
|
|||
|
|
Foreground="{StaticResource LightTextBrush}"
|
|||
|
|
IsHitTestVisible="False"
|
|||
|
|
Text="{Binding Path=(local:ElementHelper.Watermark), RelativeSource={RelativeSource TemplatedParent}}">
|
|||
|
|
<TextBlock.Style>
|
|||
|
|
<Style TargetType="TextBlock">
|
|||
|
|
<Setter Property="Visibility" Value="Collapsed" />
|
|||
|
|
<Style.Triggers>
|
|||
|
|
<!-- 当Text为空且未获得焦点时显示水印,或者一直显示直到输入 -->
|
|||
|
|
<DataTrigger Binding="{Binding Text, RelativeSource={RelativeSource AncestorType=local:SearchableComboBox}}" Value="">
|
|||
|
|
<Setter Property="Visibility" Value="Visible" />
|
|||
|
|
</DataTrigger>
|
|||
|
|
<DataTrigger Binding="{Binding Text, RelativeSource={RelativeSource AncestorType=local:SearchableComboBox}}" Value="{x:Null}">
|
|||
|
|
<Setter Property="Visibility" Value="Visible" />
|
|||
|
|
</DataTrigger>
|
|||
|
|
</Style.Triggers>
|
|||
|
|
</Style>
|
|||
|
|
</TextBlock.Style>
|
|||
|
|
</TextBlock>
|
|||
|
|
|
|||
|
|
<!-- 下拉列表 Popup -->
|
|||
|
|
<Popup
|
|||
|
|
Name="Popup"
|
|||
|
|
AllowsTransparency="True"
|
|||
|
|
Focusable="False"
|
|||
|
|
IsOpen="{TemplateBinding IsDropDownOpen}"
|
|||
|
|
Placement="Bottom"
|
|||
|
|
PopupAnimation="Slide">
|
|||
|
|
<Grid
|
|||
|
|
Name="DropDown"
|
|||
|
|
MinWidth="{TemplateBinding ActualWidth}"
|
|||
|
|
MaxHeight="{TemplateBinding MaxDropDownHeight}"
|
|||
|
|
SnapsToDevicePixels="True">
|
|||
|
|
<!-- 下拉边框背景 + 阴影 -->
|
|||
|
|
<Border
|
|||
|
|
x:Name="DropDownBorder"
|
|||
|
|
Margin="5"
|
|||
|
|
Background="White"
|
|||
|
|
BorderBrush="#EEE"
|
|||
|
|
BorderThickness="1"
|
|||
|
|
CornerRadius="4">
|
|||
|
|
<Border.Effect>
|
|||
|
|
<DropShadowEffect
|
|||
|
|
BlurRadius="10"
|
|||
|
|
Direction="270"
|
|||
|
|
Opacity="0.1"
|
|||
|
|
ShadowDepth="2"
|
|||
|
|
Color="#000" />
|
|||
|
|
</Border.Effect>
|
|||
|
|
<ScrollViewer Margin="0" SnapsToDevicePixels="True">
|
|||
|
|
<StackPanel IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Contained" />
|
|||
|
|
</ScrollViewer>
|
|||
|
|
</Border>
|
|||
|
|
</Grid>
|
|||
|
|
</Popup>
|
|||
|
|
</Grid>
|
|||
|
|
</ControlTemplate>
|
|||
|
|
</Setter.Value>
|
|||
|
|
</Setter>
|
|||
|
|
</Style>
|
|||
|
|
|
|||
|
|
<!-- ============================================== -->
|
|||
|
|
<!-- 6. CheckBox Style -->
|
|||
|
|
<!-- ============================================== -->
|
|||
|
|
<Style TargetType="CheckBox">
|
|||
|
|
<Setter Property="SnapsToDevicePixels" Value="true" />
|
|||
|
|
<Setter Property="OverridesDefaultStyle" Value="true" />
|
|||
|
|
<Setter Property="Template">
|
|||
|
|
<Setter.Value>
|
|||
|
|
<ControlTemplate TargetType="CheckBox">
|
|||
|
|
<StackPanel VerticalAlignment="Center" Orientation="Horizontal">
|
|||
|
|
<Border
|
|||
|
|
x:Name="border"
|
|||
|
|
Width="18"
|
|||
|
|
Height="18"
|
|||
|
|
Background="White"
|
|||
|
|
BorderBrush="{StaticResource BorderBrush}"
|
|||
|
|
BorderThickness="1"
|
|||
|
|
CornerRadius="3">
|
|||
|
|
<Path
|
|||
|
|
x:Name="CheckMark"
|
|||
|
|
Data="M2,9 L6,13 L14,3"
|
|||
|
|
Stroke="White"
|
|||
|
|
StrokeThickness="2"
|
|||
|
|
Visibility="Collapsed" />
|
|||
|
|
</Border>
|
|||
|
|
<ContentPresenter
|
|||
|
|
Margin="8,0,0,0"
|
|||
|
|
VerticalAlignment="Center"
|
|||
|
|
TextElement.Foreground="{StaticResource TextBrush}" />
|
|||
|
|
</StackPanel>
|
|||
|
|
<ControlTemplate.Triggers>
|
|||
|
|
<Trigger Property="IsChecked" Value="True">
|
|||
|
|
<Setter TargetName="border" Property="Background" Value="{StaticResource PrimaryBrush}" />
|
|||
|
|
<Setter TargetName="border" Property="BorderBrush" Value="{StaticResource PrimaryBrush}" />
|
|||
|
|
<Setter TargetName="CheckMark" Property="Visibility" Value="Visible" />
|
|||
|
|
</Trigger>
|
|||
|
|
<Trigger Property="IsMouseOver" Value="True">
|
|||
|
|
<Setter TargetName="border" Property="BorderBrush" Value="{StaticResource PrimaryBrush}" />
|
|||
|
|
</Trigger>
|
|||
|
|
</ControlTemplate.Triggers>
|
|||
|
|
</ControlTemplate>
|
|||
|
|
</Setter.Value>
|
|||
|
|
</Setter>
|
|||
|
|
</Style>
|
|||
|
|
|
|||
|
|
<!-- ============================================== -->
|
|||
|
|
<!-- 7. RadioButton Style -->
|
|||
|
|
<!-- ============================================== -->
|
|||
|
|
<Style TargetType="RadioButton">
|
|||
|
|
<Setter Property="SnapsToDevicePixels" Value="true" />
|
|||
|
|
<Setter Property="OverridesDefaultStyle" Value="true" />
|
|||
|
|
<Setter Property="Template">
|
|||
|
|
<Setter.Value>
|
|||
|
|
<ControlTemplate TargetType="RadioButton">
|
|||
|
|
<StackPanel VerticalAlignment="Center" Orientation="Horizontal">
|
|||
|
|
<Border
|
|||
|
|
x:Name="border"
|
|||
|
|
Width="18"
|
|||
|
|
Height="18"
|
|||
|
|
Background="White"
|
|||
|
|
BorderBrush="{StaticResource BorderBrush}"
|
|||
|
|
BorderThickness="1"
|
|||
|
|
CornerRadius="9">
|
|||
|
|
<Ellipse
|
|||
|
|
x:Name="CheckMark"
|
|||
|
|
Width="8"
|
|||
|
|
Height="8"
|
|||
|
|
Fill="White"
|
|||
|
|
Visibility="Collapsed" />
|
|||
|
|
</Border>
|
|||
|
|
<ContentPresenter
|
|||
|
|
Margin="8,0,0,0"
|
|||
|
|
VerticalAlignment="Center"
|
|||
|
|
TextElement.Foreground="{StaticResource TextBrush}" />
|
|||
|
|
</StackPanel>
|
|||
|
|
<ControlTemplate.Triggers>
|
|||
|
|
<Trigger Property="IsChecked" Value="True">
|
|||
|
|
<Setter TargetName="border" Property="Background" Value="{StaticResource PrimaryBrush}" />
|
|||
|
|
<Setter TargetName="border" Property="BorderBrush" Value="{StaticResource PrimaryBrush}" />
|
|||
|
|
<Setter TargetName="CheckMark" Property="Visibility" Value="Visible" />
|
|||
|
|
</Trigger>
|
|||
|
|
<Trigger Property="IsMouseOver" Value="True">
|
|||
|
|
<Setter TargetName="border" Property="BorderBrush" Value="{StaticResource PrimaryBrush}" />
|
|||
|
|
</Trigger>
|
|||
|
|
</ControlTemplate.Triggers>
|
|||
|
|
</ControlTemplate>
|
|||
|
|
</Setter.Value>
|
|||
|
|
</Setter>
|
|||
|
|
</Style>
|
|||
|
|
|
|||
|
|
<!-- ============================================== -->
|
|||
|
|
<!-- 8. GroupBox Style -->
|
|||
|
|
<!-- ============================================== -->
|
|||
|
|
<Style TargetType="GroupBox">
|
|||
|
|
<Setter Property="BorderBrush" Value="{StaticResource BorderBrush}" />
|
|||
|
|
<Setter Property="BorderThickness" Value="1" />
|
|||
|
|
<Setter Property="Template">
|
|||
|
|
<Setter.Value>
|
|||
|
|
<ControlTemplate TargetType="GroupBox">
|
|||
|
|
<Grid>
|
|||
|
|
<Grid.RowDefinitions>
|
|||
|
|
<RowDefinition Height="Auto" />
|
|||
|
|
<RowDefinition Height="*" />
|
|||
|
|
</Grid.RowDefinitions>
|
|||
|
|
<Border
|
|||
|
|
Grid.Row="0"
|
|||
|
|
Padding="10"
|
|||
|
|
Background="#FAFAFA"
|
|||
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
|||
|
|
BorderThickness="0,0,0,1">
|
|||
|
|
<ContentPresenter
|
|||
|
|
ContentSource="Header"
|
|||
|
|
TextElement.FontWeight="Bold"
|
|||
|
|
TextElement.Foreground="{StaticResource PrimaryBrush}" />
|
|||
|
|
</Border>
|
|||
|
|
<Border
|
|||
|
|
Grid.Row="1"
|
|||
|
|
Padding="10"
|
|||
|
|
Background="White"
|
|||
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
|||
|
|
BorderThickness="1,0,1,1">
|
|||
|
|
<ContentPresenter />
|
|||
|
|
</Border>
|
|||
|
|
</Grid>
|
|||
|
|
</ControlTemplate>
|
|||
|
|
</Setter.Value>
|
|||
|
|
</Setter>
|
|||
|
|
</Style>
|
|||
|
|
|
|||
|
|
<Style x:Key="ModernEditingTextBoxStyle" TargetType="{x:Type TextBox}">
|
|||
|
|
<Setter Property="BorderThickness" Value="1" />
|
|||
|
|
<Setter Property="BorderBrush" Value="{StaticResource BorderBrush}" />
|
|||
|
|
<Setter Property="Background" Value="{StaticResource BackgroundBrush}" />
|
|||
|
|
<Setter Property="Foreground" Value="{StaticResource TextPrimaryBrush}" />
|
|||
|
|
<Setter Property="Margin" Value="0" />
|
|||
|
|
<Setter Property="VerticalContentAlignment" Value="Center" />
|
|||
|
|
<Setter Property="Height" Value="38" />
|
|||
|
|
<Setter Property="CaretBrush" Value="{StaticResource PrimaryBrush}" />
|
|||
|
|
<Setter Property="Template">
|
|||
|
|
<Setter.Value>
|
|||
|
|
<ControlTemplate TargetType="{x:Type TextBox}">
|
|||
|
|
<Border
|
|||
|
|
x:Name="Border"
|
|||
|
|
Background="{TemplateBinding Background}"
|
|||
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
|||
|
|
BorderThickness="{TemplateBinding BorderThickness}">
|
|||
|
|
<ScrollViewer x:Name="PART_ContentHost" />
|
|||
|
|
</Border>
|
|||
|
|
<ControlTemplate.Triggers>
|
|||
|
|
<Trigger Property="IsMouseOver" Value="True">
|
|||
|
|
<Setter TargetName="Border" Property="BorderBrush" Value="{StaticResource PrimaryBrush}" />
|
|||
|
|
</Trigger>
|
|||
|
|
</ControlTemplate.Triggers>
|
|||
|
|
</ControlTemplate>
|
|||
|
|
</Setter.Value>
|
|||
|
|
</Setter>
|
|||
|
|
</Style>
|
|||
|
|
|
|||
|
|
<!-- 下拉框编辑样式 -->
|
|||
|
|
<Style x:Key="ModernEditingComboBoxStyle" TargetType="{x:Type ComboBox}">
|
|||
|
|
<Setter Property="BorderThickness" Value="1" />
|
|||
|
|
<Setter Property="BorderBrush" Value="{StaticResource BorderBrush}" />
|
|||
|
|
<Setter Property="Height" Value="38" />
|
|||
|
|
<Setter Property="Background" Value="{StaticResource BackgroundBrush}" />
|
|||
|
|
<Setter Property="HorizontalAlignment" Value="Stretch" />
|
|||
|
|
<Setter Property="VerticalAlignment" Value="Stretch" />
|
|||
|
|
<Setter Property="VerticalContentAlignment" Value="Center" />
|
|||
|
|
<Setter Property="Template">
|
|||
|
|
<Setter.Value>
|
|||
|
|
<ControlTemplate TargetType="{x:Type ComboBox}">
|
|||
|
|
<Grid>
|
|||
|
|
<TextBlock
|
|||
|
|
Margin="5,1,30,1"
|
|||
|
|
Padding="{TemplateBinding Padding}"
|
|||
|
|
HorizontalAlignment="Left"
|
|||
|
|
VerticalAlignment="Center"
|
|||
|
|
Background="{TemplateBinding Background}"
|
|||
|
|
Focusable="True"
|
|||
|
|
Style="{x:Null}"
|
|||
|
|
Text="{Binding Path=Text, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
|
|||
|
|
<ToggleButton
|
|||
|
|
Name="ToggleButton"
|
|||
|
|
Background="Transparent"
|
|||
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
|||
|
|
BorderThickness="{TemplateBinding BorderThickness}"
|
|||
|
|
ClickMode="Press"
|
|||
|
|
Focusable="false"
|
|||
|
|
IsChecked="{Binding Path=IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}">
|
|||
|
|
<ToggleButton.Template>
|
|||
|
|
<ControlTemplate TargetType="ToggleButton">
|
|||
|
|
<Border
|
|||
|
|
x:Name="Border"
|
|||
|
|
Background="{TemplateBinding Background}"
|
|||
|
|
BorderBrush="{StaticResource BorderBrush}"
|
|||
|
|
BorderThickness="{TemplateBinding BorderThickness}"
|
|||
|
|
CornerRadius="{Binding Path=(local:ElementHelper.CornerRadius), RelativeSource={RelativeSource AncestorType=local:SearchableComboBox}}">
|
|||
|
|
<Grid>
|
|||
|
|
<Grid.ColumnDefinitions>
|
|||
|
|
<ColumnDefinition />
|
|||
|
|
<ColumnDefinition Width="30" />
|
|||
|
|
</Grid.ColumnDefinitions>
|
|||
|
|
<Path
|
|||
|
|
x:Name="ArrowPath"
|
|||
|
|
Grid.Column="1"
|
|||
|
|
Width="10"
|
|||
|
|
Height="6"
|
|||
|
|
HorizontalAlignment="Center"
|
|||
|
|
VerticalAlignment="Center"
|
|||
|
|
Data="{StaticResource IconChevronDown}"
|
|||
|
|
RenderTransformOrigin="0.5,0.5"
|
|||
|
|
Stretch="Uniform"
|
|||
|
|
Stroke="{StaticResource TextBrush}"
|
|||
|
|
StrokeThickness="1.5">
|
|||
|
|
<Path.RenderTransform>
|
|||
|
|
<RotateTransform Angle="0" />
|
|||
|
|
</Path.RenderTransform>
|
|||
|
|
</Path>
|
|||
|
|
</Grid>
|
|||
|
|
</Border>
|
|||
|
|
<ControlTemplate.Triggers>
|
|||
|
|
<Trigger Property="IsMouseOver" Value="True">
|
|||
|
|
<Setter TargetName="Border" Property="BorderBrush" Value="{StaticResource PrimaryBrush}" />
|
|||
|
|
</Trigger>
|
|||
|
|
<!-- 箭头旋转动画 -->
|
|||
|
|
<Trigger Property="IsChecked" Value="True">
|
|||
|
|
<Trigger.EnterActions>
|
|||
|
|
<BeginStoryboard>
|
|||
|
|
<Storyboard>
|
|||
|
|
<DoubleAnimation
|
|||
|
|
Storyboard.TargetName="ArrowPath"
|
|||
|
|
Storyboard.TargetProperty="(UIElement.RenderTransform).(RotateTransform.Angle)"
|
|||
|
|
To="180"
|
|||
|
|
Duration="0:0:0.2" />
|
|||
|
|
</Storyboard>
|
|||
|
|
</BeginStoryboard>
|
|||
|
|
</Trigger.EnterActions>
|
|||
|
|
<Trigger.ExitActions>
|
|||
|
|
<BeginStoryboard>
|
|||
|
|
<Storyboard>
|
|||
|
|
<DoubleAnimation
|
|||
|
|
Storyboard.TargetName="ArrowPath"
|
|||
|
|
Storyboard.TargetProperty="(UIElement.RenderTransform).(RotateTransform.Angle)"
|
|||
|
|
To="0"
|
|||
|
|
Duration="0:0:0.2" />
|
|||
|
|
</Storyboard>
|
|||
|
|
</BeginStoryboard>
|
|||
|
|
</Trigger.ExitActions>
|
|||
|
|
</Trigger>
|
|||
|
|
</ControlTemplate.Triggers>
|
|||
|
|
</ControlTemplate>
|
|||
|
|
</ToggleButton.Template>
|
|||
|
|
</ToggleButton>
|
|||
|
|
<!-- 下拉列表 Popup -->
|
|||
|
|
<Popup
|
|||
|
|
Name="Popup"
|
|||
|
|
AllowsTransparency="True"
|
|||
|
|
Focusable="False"
|
|||
|
|
IsOpen="{TemplateBinding IsDropDownOpen}"
|
|||
|
|
Placement="Bottom"
|
|||
|
|
PopupAnimation="Slide">
|
|||
|
|
<Grid
|
|||
|
|
Name="DropDown"
|
|||
|
|
MinWidth="{TemplateBinding ActualWidth}"
|
|||
|
|
MaxHeight="{TemplateBinding MaxDropDownHeight}"
|
|||
|
|
SnapsToDevicePixels="True">
|
|||
|
|
<!-- 下拉边框背景 + 阴影 -->
|
|||
|
|
<Border
|
|||
|
|
x:Name="DropDownBorder"
|
|||
|
|
Margin="5"
|
|||
|
|
Background="{StaticResource BackgroundBrush}"
|
|||
|
|
BorderBrush="#EEE"
|
|||
|
|
BorderThickness="1"
|
|||
|
|
CornerRadius="4">
|
|||
|
|
<Border.Effect>
|
|||
|
|
<DropShadowEffect
|
|||
|
|
BlurRadius="10"
|
|||
|
|
Direction="270"
|
|||
|
|
Opacity="0.1"
|
|||
|
|
ShadowDepth="2"
|
|||
|
|
Color="#000" />
|
|||
|
|
</Border.Effect>
|
|||
|
|
<ScrollViewer Margin="0" SnapsToDevicePixels="True">
|
|||
|
|
<StackPanel IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Contained" />
|
|||
|
|
</ScrollViewer>
|
|||
|
|
</Border>
|
|||
|
|
</Grid>
|
|||
|
|
</Popup>
|
|||
|
|
</Grid>
|
|||
|
|
</ControlTemplate>
|
|||
|
|
</Setter.Value>
|
|||
|
|
</Setter>
|
|||
|
|
</Style>
|
|||
|
|
|
|||
|
|
<!-- =========================== -->
|
|||
|
|
<!-- 1. 表头样式 (悬停反色:绿底白字) -->
|
|||
|
|
<!-- =========================== -->
|
|||
|
|
<Style x:Key="ColumnHeaderGripperStyle" TargetType="{x:Type Thumb}">
|
|||
|
|
<Setter Property="Width" Value="8" />
|
|||
|
|
<Setter Property="Background" Value="Transparent" />
|
|||
|
|
<Setter Property="Cursor" Value="SizeWE" />
|
|||
|
|
<Setter Property="Template">
|
|||
|
|
<Setter.Value>
|
|||
|
|
<ControlTemplate TargetType="{x:Type Thumb}">
|
|||
|
|
<Border Padding="{TemplateBinding Padding}" Background="{TemplateBinding Background}" />
|
|||
|
|
</ControlTemplate>
|
|||
|
|
</Setter.Value>
|
|||
|
|
</Setter>
|
|||
|
|
</Style>
|
|||
|
|
|
|||
|
|
|
|||
|
|
<Style x:Key="ModernGridHeaderStyle" TargetType="{x:Type DataGridColumnHeader}">
|
|||
|
|
<Setter Property="Background" Value="{StaticResource BackgroundBrush}" />
|
|||
|
|
<Setter Property="Foreground" Value="{StaticResource TextPrimaryBrush}" />
|
|||
|
|
<Setter Property="FontSize" Value="13" />
|
|||
|
|
<Setter Property="FontWeight" Value="Bold" />
|
|||
|
|
<Setter Property="Padding" Value="10,12" />
|
|||
|
|
<Setter Property="HorizontalContentAlignment" Value="Left" />
|
|||
|
|
<Setter Property="BorderThickness" Value="0,0,0,2" />
|
|||
|
|
<Setter Property="BorderBrush" Value="{StaticResource PrimaryBrush}" />
|
|||
|
|
<Setter Property="Template">
|
|||
|
|
<Setter.Value>
|
|||
|
|
<ControlTemplate TargetType="{x:Type DataGridColumnHeader}">
|
|||
|
|
<Grid>
|
|||
|
|
<Border
|
|||
|
|
Padding="{TemplateBinding Padding}"
|
|||
|
|
Background="{TemplateBinding Background}"
|
|||
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
|||
|
|
BorderThickness="{TemplateBinding BorderThickness}">
|
|||
|
|
<Grid>
|
|||
|
|
<Grid.ColumnDefinitions>
|
|||
|
|
<ColumnDefinition Width="*" />
|
|||
|
|
<ColumnDefinition Width="Auto" />
|
|||
|
|
</Grid.ColumnDefinitions>
|
|||
|
|
<ContentPresenter
|
|||
|
|
Grid.Column="0"
|
|||
|
|
VerticalAlignment="Center"
|
|||
|
|
SnapsToDevicePixels="True" />
|
|||
|
|
<Viewbox
|
|||
|
|
Grid.Column="1"
|
|||
|
|
Width="12"
|
|||
|
|
Height="12"
|
|||
|
|
Margin="5,0,0,0">
|
|||
|
|
<Path
|
|||
|
|
x:Name="SortArrow"
|
|||
|
|
VerticalAlignment="Center"
|
|||
|
|
Data="{StaticResource IconChevronDown}"
|
|||
|
|
RenderTransformOrigin="0.5,0.5"
|
|||
|
|
Stretch="Uniform"
|
|||
|
|
Stroke="{TemplateBinding Foreground}"
|
|||
|
|
Visibility="Collapsed" />
|
|||
|
|
</Viewbox>
|
|||
|
|
</Grid>
|
|||
|
|
</Border>
|
|||
|
|
<Thumb
|
|||
|
|
x:Name="PART_RightHeaderGripper"
|
|||
|
|
Grid.Column="1"
|
|||
|
|
HorizontalAlignment="Right"
|
|||
|
|
Style="{StaticResource ColumnHeaderGripperStyle}" />
|
|||
|
|
</Grid>
|
|||
|
|
<ControlTemplate.Triggers>
|
|||
|
|
<!-- 悬停样式:绿底白字 -->
|
|||
|
|
<Trigger Property="IsMouseOver" Value="True">
|
|||
|
|
<Setter Property="Background" Value="{StaticResource PrimaryBrush}" />
|
|||
|
|
<Setter Property="Foreground" Value="{StaticResource AccentTextBrush}" />
|
|||
|
|
<Setter Property="BorderBrush" Value="{StaticResource PrimaryBrush}" />
|
|||
|
|
</Trigger>
|
|||
|
|
<Trigger Property="SortDirection" Value="Ascending">
|
|||
|
|
<Setter TargetName="SortArrow" Property="Visibility" Value="Visible" />
|
|||
|
|
<Setter TargetName="SortArrow" Property="RenderTransform">
|
|||
|
|
<Setter.Value>
|
|||
|
|
<RotateTransform Angle="180" />
|
|||
|
|
</Setter.Value>
|
|||
|
|
</Setter>
|
|||
|
|
</Trigger>
|
|||
|
|
<Trigger Property="SortDirection" Value="Descending">
|
|||
|
|
<Setter TargetName="SortArrow" Property="Visibility" Value="Visible" />
|
|||
|
|
<Setter TargetName="SortArrow" Property="RenderTransform">
|
|||
|
|
<Setter.Value>
|
|||
|
|
<RotateTransform Angle="0" />
|
|||
|
|
</Setter.Value>
|
|||
|
|
</Setter>
|
|||
|
|
</Trigger>
|
|||
|
|
</ControlTemplate.Triggers>
|
|||
|
|
</ControlTemplate>
|
|||
|
|
</Setter.Value>
|
|||
|
|
</Setter>
|
|||
|
|
</Style>
|
|||
|
|
|
|||
|
|
<!-- =========================== -->
|
|||
|
|
<!-- 3. 单元格样式 (修复选中背景丢失 & 垂直居中) -->
|
|||
|
|
<!-- =========================== -->
|
|||
|
|
<Style x:Key="ModernGridCellStyle" TargetType="{x:Type DataGridCell}">
|
|||
|
|
<!-- 1. 将内边距设为 0,让内容可以抵到边缘 -->
|
|||
|
|
<Setter Property="Padding" Value="0" />
|
|||
|
|
<Setter Property="Background" Value="Transparent" />
|
|||
|
|
<Setter Property="BorderThickness" Value="0" />
|
|||
|
|
|
|||
|
|
<!-- 2. 核心:默认拉伸内容,填满整个格子 -->
|
|||
|
|
<Setter Property="HorizontalContentAlignment" Value="Center" />
|
|||
|
|
<Setter Property="VerticalContentAlignment" Value="Stretch" />
|
|||
|
|
|
|||
|
|
<Setter Property="Template">
|
|||
|
|
<Setter.Value>
|
|||
|
|
<ControlTemplate TargetType="{x:Type DataGridCell}">
|
|||
|
|
<Border
|
|||
|
|
Padding="{TemplateBinding Padding}"
|
|||
|
|
Background="{TemplateBinding Background}"
|
|||
|
|
BorderThickness="0"
|
|||
|
|
SnapsToDevicePixels="True">
|
|||
|
|
<!-- 3. 将对齐方式绑定到属性,而不是写死 Center -->
|
|||
|
|
<ContentPresenter
|
|||
|
|
HorizontalAlignment="Stretch"
|
|||
|
|
VerticalAlignment="Center"
|
|||
|
|
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
|
|||
|
|
</Border>
|
|||
|
|
</ControlTemplate>
|
|||
|
|
</Setter.Value>
|
|||
|
|
</Setter>
|
|||
|
|
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
|
|||
|
|
|
|||
|
|
<!-- 4. 关键修正:因为上面设置了 Stretch,会导致文本列贴在左上角 -->
|
|||
|
|
<!-- 这里定义一个隐式样式,专门把 TextColumn 中的文字“拉”回到垂直居中,并加左侧边距 -->
|
|||
|
|
<Style.Resources>
|
|||
|
|
<Style TargetType="TextBlock">
|
|||
|
|
<Setter Property="VerticalAlignment" Value="Center" />
|
|||
|
|
<Setter Property="HorizontalAlignment" Value="Left" />
|
|||
|
|
<Setter Property="Margin" Value="10,0,0,0" />
|
|||
|
|
<!-- 这里控制文字的左边距 -->
|
|||
|
|
</Style>
|
|||
|
|
</Style.Resources>
|
|||
|
|
|
|||
|
|
<Style.Triggers>
|
|||
|
|
<Trigger Property="IsSelected" Value="True">
|
|||
|
|
<Setter Property="Background" Value="{StaticResource AlternalBrush}" />
|
|||
|
|
<Setter Property="Foreground" Value="{StaticResource TextPrimaryBrush}" />
|
|||
|
|
</Trigger>
|
|||
|
|
<Trigger Property="IsEditing" Value="True">
|
|||
|
|
<Setter Property="Background" Value="{StaticResource BackgroundBrush}" />
|
|||
|
|
<Setter Property="Foreground" Value="{StaticResource TextPrimaryBrush}" />
|
|||
|
|
</Trigger>
|
|||
|
|
</Style.Triggers>
|
|||
|
|
</Style>
|
|||
|
|
|
|||
|
|
<!-- =========================== -->
|
|||
|
|
<!-- 4. 行样式 -->
|
|||
|
|
<!-- =========================== -->
|
|||
|
|
<Style x:Key="ModernGridRowStyle" TargetType="{x:Type DataGridRow}">
|
|||
|
|
<Setter Property="Background" Value="{StaticResource BackgroundBrush}" />
|
|||
|
|
<Style.Triggers>
|
|||
|
|
<Trigger Property="IsMouseOver" Value="True">
|
|||
|
|
<Setter Property="Background" Value="{StaticResource AlternalBrush}" />
|
|||
|
|
</Trigger>
|
|||
|
|
<!-- 选中时透明,由 Cell 负责颜色,防止遮挡 -->
|
|||
|
|
<Trigger Property="IsSelected" Value="True">
|
|||
|
|
<Setter Property="Background" Value="Transparent" />
|
|||
|
|
</Trigger>
|
|||
|
|
</Style.Triggers>
|
|||
|
|
</Style>
|
|||
|
|
|
|||
|
|
<!-- =========================== -->
|
|||
|
|
<!-- 5. DataGrid 主样式 (修复圆角裁剪) -->
|
|||
|
|
<!-- =========================== -->
|
|||
|
|
<Style TargetType="{x:Type DataGrid}">
|
|||
|
|
<Setter Property="Background" Value="{StaticResource BackgroundBrush}" />
|
|||
|
|
<Setter Property="BorderBrush" Value="{StaticResource BorderBrush}" />
|
|||
|
|
<Setter Property="BorderThickness" Value="1" />
|
|||
|
|
<Setter Property="RowHeight" Value="42" />
|
|||
|
|
<Setter Property="FontSize" Value="14" />
|
|||
|
|
<Setter Property="Foreground" Value="{StaticResource TextPrimaryBrush}" />
|
|||
|
|
<Setter Property="GridLinesVisibility" Value="Horizontal" />
|
|||
|
|
<Setter Property="HorizontalGridLinesBrush" Value="{StaticResource TextSecondBrush}" />
|
|||
|
|
<Setter Property="VerticalGridLinesBrush" Value="Transparent" />
|
|||
|
|
<Setter Property="HeadersVisibility" Value="Column" />
|
|||
|
|
<Setter Property="AutoGenerateColumns" Value="False" />
|
|||
|
|
<Setter Property="CanUserResizeColumns" Value="True" />
|
|||
|
|
<Setter Property="CanUserSortColumns" Value="True" />
|
|||
|
|
<Setter Property="AlternationCount" Value="2" />
|
|||
|
|
<Setter Property="AlternatingRowBackground" Value="{StaticResource AlternalBrush}" />
|
|||
|
|
|
|||
|
|
<Setter Property="ColumnHeaderStyle" Value="{StaticResource ModernGridHeaderStyle}" />
|
|||
|
|
<Setter Property="CellStyle" Value="{StaticResource ModernGridCellStyle}" />
|
|||
|
|
<Setter Property="RowStyle" Value="{StaticResource ModernGridRowStyle}" />
|
|||
|
|
|
|||
|
|
<Setter Property="Template">
|
|||
|
|
<Setter.Value>
|
|||
|
|
<ControlTemplate TargetType="{x:Type DataGrid}">
|
|||
|
|
<!-- 外层 Grid -->
|
|||
|
|
<Grid>
|
|||
|
|
<!-- 这里的 Border 负责画边框和圆角 -->
|
|||
|
|
<Border
|
|||
|
|
x:Name="MainBorder"
|
|||
|
|
Background="{TemplateBinding Background}"
|
|||
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
|||
|
|
BorderThickness="{TemplateBinding BorderThickness}"
|
|||
|
|
CornerRadius="8">
|
|||
|
|
|
|||
|
|
<!-- 这里的 ScrollViewer 负责显示内容 -->
|
|||
|
|
<ScrollViewer x:Name="DG_ScrollViewer" Focusable="false">
|
|||
|
|
<!-- 【终极圆角修复】使用 OpacityMask 强制裁切 -->
|
|||
|
|
<!-- 这会根据 MainBorder 的形状切掉多余的表头背景 -->
|
|||
|
|
<ScrollViewer.OpacityMask>
|
|||
|
|
<VisualBrush>
|
|||
|
|
<VisualBrush.Visual>
|
|||
|
|
<Border
|
|||
|
|
Width="{Binding ActualWidth, ElementName=MainBorder}"
|
|||
|
|
Height="{Binding ActualHeight, ElementName=MainBorder}"
|
|||
|
|
Background="Black"
|
|||
|
|
CornerRadius="7.5" />
|
|||
|
|
<!-- 半径略微小一点避免黑边 -->
|
|||
|
|
</VisualBrush.Visual>
|
|||
|
|
</VisualBrush>
|
|||
|
|
</ScrollViewer.OpacityMask>
|
|||
|
|
|
|||
|
|
<ScrollViewer.Template>
|
|||
|
|
<ControlTemplate TargetType="{x:Type ScrollViewer}">
|
|||
|
|
<Grid>
|
|||
|
|
<Grid.ColumnDefinitions>
|
|||
|
|
<ColumnDefinition Width="Auto" />
|
|||
|
|
<ColumnDefinition Width="*" />
|
|||
|
|
<ColumnDefinition Width="Auto" />
|
|||
|
|
</Grid.ColumnDefinitions>
|
|||
|
|
<Grid.RowDefinitions>
|
|||
|
|
<RowDefinition Height="Auto" />
|
|||
|
|
<RowDefinition Height="*" />
|
|||
|
|
<RowDefinition Height="Auto" />
|
|||
|
|
</Grid.RowDefinitions>
|
|||
|
|
|
|||
|
|
<Button
|
|||
|
|
Width="{Binding CellsPanelHorizontalOffset, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"
|
|||
|
|
Command="{x:Static DataGrid.SelectAllCommand}"
|
|||
|
|
Focusable="false"
|
|||
|
|
Visibility="{Binding HeadersVisibility, ConverterParameter={x:Static DataGridHeadersVisibility.All}, Converter={x:Static DataGrid.HeadersVisibilityConverter}, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}" />
|
|||
|
|
<DataGridColumnHeadersPresenter
|
|||
|
|
x:Name="PART_ColumnHeadersPresenter"
|
|||
|
|
Grid.Column="1"
|
|||
|
|
Visibility="{Binding HeadersVisibility, ConverterParameter={x:Static DataGridHeadersVisibility.Column}, Converter={x:Static DataGrid.HeadersVisibilityConverter}, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}" />
|
|||
|
|
<ScrollContentPresenter
|
|||
|
|
x:Name="PART_ScrollContentPresenter"
|
|||
|
|
Grid.Row="1"
|
|||
|
|
Grid.ColumnSpan="2"
|
|||
|
|
CanContentScroll="{TemplateBinding CanContentScroll}" />
|
|||
|
|
<ScrollBar
|
|||
|
|
x:Name="PART_VerticalScrollBar"
|
|||
|
|
Grid.Row="1"
|
|||
|
|
Grid.Column="2"
|
|||
|
|
Maximum="{TemplateBinding ScrollableHeight}"
|
|||
|
|
Orientation="Vertical"
|
|||
|
|
ViewportSize="{TemplateBinding ViewportHeight}"
|
|||
|
|
Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}"
|
|||
|
|
Value="{Binding VerticalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" />
|
|||
|
|
<ScrollBar
|
|||
|
|
x:Name="PART_HorizontalScrollBar"
|
|||
|
|
Grid.Row="2"
|
|||
|
|
Grid.Column="1"
|
|||
|
|
Maximum="{TemplateBinding ScrollableWidth}"
|
|||
|
|
Orientation="Horizontal"
|
|||
|
|
ViewportSize="{TemplateBinding ViewportWidth}"
|
|||
|
|
Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}"
|
|||
|
|
Value="{Binding HorizontalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" />
|
|||
|
|
</Grid>
|
|||
|
|
</ControlTemplate>
|
|||
|
|
</ScrollViewer.Template>
|
|||
|
|
<ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
|
|||
|
|
</ScrollViewer>
|
|||
|
|
</Border>
|
|||
|
|
</Grid>
|
|||
|
|
</ControlTemplate>
|
|||
|
|
</Setter.Value>
|
|||
|
|
</Setter>
|
|||
|
|
</Style>
|
|||
|
|
</ResourceDictionary>
|