You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
375 lines
24 KiB
Plaintext
375 lines
24 KiB
Plaintext
1 year ago
|
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||
|
xmlns:Microsoft_Windows_Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero">
|
||
|
<Style TargetType="{x:Type DataGridColumnHeader}">
|
||
|
<Setter Property="VerticalContentAlignment" Value="Center" />
|
||
|
<Setter Property="Height" Value="25" />
|
||
|
<Setter Property="SeparatorBrush" Value="#336699" />
|
||
|
<Setter Property="FontWeight" Value="Bold" />
|
||
|
<Setter Property="Template">
|
||
|
<Setter.Value>
|
||
|
<ControlTemplate TargetType="{x:Type DataGridColumnHeader}">
|
||
|
<Grid>
|
||
|
<VisualStateManager.VisualStateGroups>
|
||
|
<VisualStateGroup x:Name="CommonStates">
|
||
|
<VisualState x:Name="Normal" />
|
||
|
<VisualState x:Name="MouseOver">
|
||
|
<Storyboard>
|
||
|
<ColorAnimationUsingKeyFrames Storyboard.TargetName="columnHeaderBorder" Storyboard.TargetProperty="(Panel.Background).(GradientBrush.GradientStops)[1].(GradientStop.Color)">
|
||
|
<EasingColorKeyFrame KeyTime="0" Value="LightBlue" />
|
||
|
</ColorAnimationUsingKeyFrames>
|
||
|
</Storyboard>
|
||
|
</VisualState>
|
||
|
</VisualStateGroup>
|
||
|
</VisualStateManager.VisualStateGroups>
|
||
|
<Border x:Name="columnHeaderBorder"
|
||
|
BorderThickness="1"
|
||
|
Padding="3,0,3,0">
|
||
|
<Border.BorderBrush>
|
||
|
<LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
|
||
|
<GradientStop Offset="0" Color="#666699" />
|
||
|
<GradientStop Offset="1" Color="#666699" />
|
||
|
</LinearGradientBrush>
|
||
|
</Border.BorderBrush>
|
||
|
<Border.Background>
|
||
|
<LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
|
||
|
<GradientStop Offset="0" Color="#6699CC" />
|
||
|
<GradientStop Offset="1" Color="#99CCFF" />
|
||
|
</LinearGradientBrush>
|
||
|
</Border.Background>
|
||
|
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||
|
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
|
||
|
</Border>
|
||
|
</Grid>
|
||
|
</ControlTemplate>
|
||
|
</Setter.Value>
|
||
|
</Setter>
|
||
|
</Style>
|
||
|
<Style TargetType="{x:Type DataGridRow}">
|
||
|
<Setter Property="Background" Value="AliceBlue" />
|
||
|
<Setter Property="SnapsToDevicePixels" Value="true" />
|
||
|
<Setter Property="Height" Value="25" />
|
||
|
<Setter Property="Validation.ErrorTemplate" Value="{x:Null}" />
|
||
|
<Setter Property="ValidationErrorTemplate">
|
||
|
<Setter.Value>
|
||
|
<ControlTemplate>
|
||
|
<TextBlock Margin="2,0,0,0"
|
||
|
VerticalAlignment="Center"
|
||
|
HorizontalAlignment="Center"
|
||
|
Foreground="AliceBlue"
|
||
|
Text="!" />
|
||
|
</ControlTemplate>
|
||
|
</Setter.Value>
|
||
|
</Setter>
|
||
|
<Setter Property="Template">
|
||
|
<Setter.Value>
|
||
|
<ControlTemplate TargetType="{x:Type DataGridRow}">
|
||
|
<Border x:Name="DGR_Border"
|
||
|
BorderBrush="{TemplateBinding BorderBrush}"
|
||
|
BorderThickness="{TemplateBinding BorderThickness}"
|
||
|
SnapsToDevicePixels="True">
|
||
|
<Border.Background>
|
||
|
<LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
|
||
|
<GradientStop Offset="0" Color="#99CCFF" />
|
||
|
<GradientStop Offset="1" Color="#99CCFF" />
|
||
|
</LinearGradientBrush>
|
||
|
</Border.Background>
|
||
|
<VisualStateManager.VisualStateGroups>
|
||
|
<VisualStateGroup x:Name="CommonStates">
|
||
|
<VisualState x:Name="Normal" />
|
||
|
<VisualState x:Name="Normal_AlternatingRow">
|
||
|
<Storyboard>
|
||
|
<ColorAnimationUsingKeyFrames Storyboard.TargetName="DGR_Border"
|
||
|
Storyboard.TargetProperty="(Panel.Background).(GradientBrush.GradientStops)[0].(GradientStop.Color)">
|
||
|
<EasingColorKeyFrame KeyTime="0" Value="#ffffff" />
|
||
|
</ColorAnimationUsingKeyFrames>
|
||
|
<ColorAnimationUsingKeyFrames Storyboard.TargetName="DGR_Border"
|
||
|
Storyboard.TargetProperty="(Panel.Background).(GradientBrush.GradientStops)[1].(GradientStop.Color)">
|
||
|
<EasingColorKeyFrame KeyTime="0" Value="#ffffff" />
|
||
|
</ColorAnimationUsingKeyFrames>
|
||
|
</Storyboard>
|
||
|
</VisualState>
|
||
|
<VisualState x:Name="Normal_Selected">
|
||
|
<Storyboard>
|
||
|
<ColorAnimationUsingKeyFrames Storyboard.TargetName="DGR_Border"
|
||
|
Storyboard.TargetProperty="(Panel.Background).(GradientBrush.GradientStops)[0].(GradientStop.Color)">
|
||
|
<EasingColorKeyFrame KeyTime="0" Value="#CCAA0000" />
|
||
|
</ColorAnimationUsingKeyFrames>
|
||
|
<ColorAnimationUsingKeyFrames Storyboard.TargetName="DGR_Border"
|
||
|
Storyboard.TargetProperty="(Panel.Background).(GradientBrush.GradientStops)[1].(GradientStop.Color)">
|
||
|
<EasingColorKeyFrame KeyTime="0" Value="#77D52B00" />
|
||
|
</ColorAnimationUsingKeyFrames>
|
||
|
</Storyboard>
|
||
|
</VisualState>
|
||
|
<VisualState x:Name="MouseOver">
|
||
|
<Storyboard>
|
||
|
<ColorAnimationUsingKeyFrames Storyboard.TargetName="DGR_Border"
|
||
|
Storyboard.TargetProperty="(Panel.Background).(GradientBrush.GradientStops)[0].(GradientStop.Color)">
|
||
|
<EasingColorKeyFrame KeyTime="0" Value="#3399CC" />
|
||
|
</ColorAnimationUsingKeyFrames>
|
||
|
<ColorAnimationUsingKeyFrames Storyboard.TargetName="DGR_Border"
|
||
|
Storyboard.TargetProperty="(Panel.Background).(GradientBrush.GradientStops)[1].(GradientStop.Color)">
|
||
|
<EasingColorKeyFrame KeyTime="0" Value="#3399CC" />
|
||
|
</ColorAnimationUsingKeyFrames>
|
||
|
</Storyboard>
|
||
|
</VisualState>
|
||
|
</VisualStateGroup>
|
||
|
</VisualStateManager.VisualStateGroups>
|
||
|
<SelectiveScrollingGrid>
|
||
|
<SelectiveScrollingGrid.ColumnDefinitions>
|
||
|
<ColumnDefinition Width="Auto" />
|
||
|
<ColumnDefinition Width="*" />
|
||
|
</SelectiveScrollingGrid.ColumnDefinitions>
|
||
|
<SelectiveScrollingGrid.RowDefinitions>
|
||
|
<RowDefinition Height="*" />
|
||
|
|
||
|
<RowDefinition Height="Auto" />
|
||
|
</SelectiveScrollingGrid.RowDefinitions>
|
||
|
<DataGridCellsPresenter Grid.Column="1"
|
||
|
ItemsPanel="{TemplateBinding ItemsPanel}"
|
||
|
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
|
||
|
<DataGridDetailsPresenter Grid.Row="1"
|
||
|
Grid.Column="1"
|
||
|
SelectiveScrollingGrid.SelectiveScrollingOrientation="{Binding AreRowDetailsFrozen,
|
||
|
ConverterParameter={x:Static SelectiveScrollingOrientation.Vertical},
|
||
|
Converter={x:Static DataGrid.RowDetailsScrollingConverter},
|
||
|
RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"
|
||
|
Visibility="{TemplateBinding DetailsVisibility}" />
|
||
|
<DataGridRowHeader Grid.RowSpan="2"
|
||
|
SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical"
|
||
|
Visibility="{Binding HeadersVisibility,
|
||
|
ConverterParameter={x:Static DataGridHeadersVisibility.Row},
|
||
|
Converter={x:Static DataGrid.HeadersVisibilityConverter},
|
||
|
RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}" />
|
||
|
</SelectiveScrollingGrid>
|
||
|
</Border>
|
||
|
</ControlTemplate>
|
||
|
</Setter.Value>
|
||
|
</Setter>
|
||
|
</Style>
|
||
|
<!--<Style TargetType="{x:Type DataGridCell}">
|
||
|
<Setter Property="Template">
|
||
|
<Setter.Value>
|
||
|
<ControlTemplate TargetType="{x:Type DataGridCell}">
|
||
|
<Border x:Name="border"
|
||
|
Background="Transparent"
|
||
|
BorderBrush="Transparent"
|
||
|
BorderThickness="1"
|
||
|
SnapsToDevicePixels="True">
|
||
|
<VisualStateManager.VisualStateGroups>
|
||
|
<VisualStateGroup x:Name="FocusStates">
|
||
|
<VisualState x:Name="Unfocused" />
|
||
|
<VisualState x:Name="Focused" />
|
||
|
</VisualStateGroup>
|
||
|
<VisualStateGroup x:Name="CurrentStates">
|
||
|
<VisualState x:Name="Regular" />
|
||
|
<VisualState x:Name="Current">
|
||
|
<Storyboard>
|
||
|
<ColorAnimationUsingKeyFrames Storyboard.TargetName="border" Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)">
|
||
|
<EasingColorKeyFrame KeyTime="0" Value="Gray" />
|
||
|
</ColorAnimationUsingKeyFrames>
|
||
|
</Storyboard>
|
||
|
</VisualState>
|
||
|
</VisualStateGroup>
|
||
|
</VisualStateManager.VisualStateGroups>
|
||
|
<ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
|
||
|
</Border>
|
||
|
</ControlTemplate>
|
||
|
</Setter.Value>
|
||
|
</Setter>
|
||
|
</Style>-->
|
||
|
<!--<Style TargetType="ToggleButton">
|
||
|
<Setter Property="Padding" Value="3" />
|
||
|
<Setter Property="Template">
|
||
|
<Setter.Value>
|
||
|
<ControlTemplate TargetType="ToggleButton">
|
||
|
<Grid>
|
||
|
<VisualStateManager.VisualStateGroups>
|
||
|
<VisualStateGroup x:Name="CommonStates">
|
||
|
<VisualState x:Name="Normal" />
|
||
|
<VisualState x:Name="MouseOver">
|
||
|
<Storyboard>
|
||
|
<ColorAnimationUsingKeyFrames Storyboard.TargetName="DefaultPath" Storyboard.TargetProperty="(Path.Fill).(SolidColorBrush.Color)">
|
||
|
<SplineColorKeyFrame KeyTime="0:0:0.2" Value="#AA0000" />
|
||
|
</ColorAnimationUsingKeyFrames>
|
||
|
</Storyboard>
|
||
|
</VisualState>
|
||
|
<VisualState x:Name="Pressed" />
|
||
|
<VisualState x:Name="Disabled" />
|
||
|
</VisualStateGroup>
|
||
|
<VisualStateGroup x:Name="CheckStates">
|
||
|
<VisualState x:Name="Checked">
|
||
|
<Storyboard>
|
||
|
<ObjectAnimationUsingKeyFrames Duration="0"
|
||
|
Storyboard.TargetName="DefaultPath"
|
||
|
Storyboard.TargetProperty="Visibility">
|
||
|
<DiscreteObjectKeyFrame KeyTime="0">
|
||
|
<DiscreteObjectKeyFrame.Value>
|
||
|
<Visibility>Collapsed</Visibility>
|
||
|
</DiscreteObjectKeyFrame.Value>
|
||
|
</DiscreteObjectKeyFrame>
|
||
|
</ObjectAnimationUsingKeyFrames>
|
||
|
<ObjectAnimationUsingKeyFrames Duration="0"
|
||
|
Storyboard.TargetName="CheckedPath"
|
||
|
Storyboard.TargetProperty="Visibility">
|
||
|
<DiscreteObjectKeyFrame KeyTime="0">
|
||
|
<DiscreteObjectKeyFrame.Value>
|
||
|
<Visibility>Visible</Visibility>
|
||
|
</DiscreteObjectKeyFrame.Value>
|
||
|
</DiscreteObjectKeyFrame>
|
||
|
</ObjectAnimationUsingKeyFrames>
|
||
|
<ColorAnimationUsingKeyFrames Storyboard.TargetName="CheckedPath" Storyboard.TargetProperty="(Path.Fill).(SolidColorBrush.Color)">
|
||
|
<SplineColorKeyFrame KeyTime="0:0:0.2" Value="#0099CC" />
|
||
|
</ColorAnimationUsingKeyFrames>
|
||
|
</Storyboard>
|
||
|
</VisualState>
|
||
|
<VisualState x:Name="Unchecked" />
|
||
|
</VisualStateGroup>
|
||
|
</VisualStateManager.VisualStateGroups>
|
||
|
<ContentPresenter x:Name="contentPresenter"
|
||
|
Margin="{TemplateBinding Padding}"
|
||
|
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||
|
Content="{TemplateBinding Content}"
|
||
|
ContentTemplate="{TemplateBinding ContentTemplate}" />
|
||
|
<Path x:Name="DefaultPath"
|
||
|
VerticalAlignment="Top"
|
||
|
Data="M0,0 14,7 0,14 Z"
|
||
|
Fill="Gray"
|
||
|
Stretch="Fill" />
|
||
|
<Path x:Name="CheckedPath"
|
||
|
VerticalAlignment="Top"
|
||
|
Data="M0,0 14,0 7,14 Z"
|
||
|
Fill="LightGray"
|
||
|
Stretch="Fill"
|
||
|
Visibility="Collapsed" />
|
||
|
</Grid>
|
||
|
</ControlTemplate>
|
||
|
</Setter.Value>
|
||
|
</Setter>
|
||
|
</Style>-->
|
||
|
<Style TargetType="{x:Type DataGrid}">
|
||
|
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
|
||
|
<Setter Property="RowDetailsVisibilityMode" Value="VisibleWhenSelected" />
|
||
|
<Setter Property="ScrollViewer.CanContentScroll" Value="True" />
|
||
|
<Setter Property="ScrollViewer.PanningMode" Value="Both" />
|
||
|
<Setter Property="Stylus.IsFlicksEnabled" Value="False" />
|
||
|
<Setter Property="Template">
|
||
|
<Setter.Value>
|
||
|
<ControlTemplate TargetType="{x:Type DataGrid}">
|
||
|
<Border Background="{TemplateBinding Background}"
|
||
|
BorderBrush="{TemplateBinding BorderBrush}"
|
||
|
BorderThickness="0"
|
||
|
CornerRadius="0"
|
||
|
Padding="{TemplateBinding Padding}"
|
||
|
SnapsToDevicePixels="True">
|
||
|
<ScrollViewer x:Name="DG_ScrollViewer" Focusable="false">
|
||
|
<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"
|
||
|
Style="{DynamicResource {ComponentResourceKey ResourceId=DataGridSelectAllButtonStyle,
|
||
|
TypeInTargetAssembly={x:Type DataGrid}}}"
|
||
|
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"
|
||
|
Style="{DynamicResource MyScrollBar}"
|
||
|
ViewportSize="{TemplateBinding ViewportHeight}"
|
||
|
Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}"
|
||
|
Value="{Binding VerticalOffset,
|
||
|
Mode=OneWay,
|
||
|
RelativeSource={RelativeSource TemplatedParent}}" />
|
||
|
<Grid Grid.Row="2" Grid.Column="1">
|
||
|
<Grid.ColumnDefinitions>
|
||
|
<ColumnDefinition Width="{Binding NonFrozenColumnsViewportHorizontalOffset, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}" />
|
||
|
<ColumnDefinition Width="*" />
|
||
|
</Grid.ColumnDefinitions>
|
||
|
<ScrollBar x:Name="PART_HorizontalScrollBar"
|
||
|
Grid.Column="1"
|
||
|
Maximum="{TemplateBinding ScrollableWidth}"
|
||
|
Orientation="Horizontal"
|
||
|
ViewportSize="{TemplateBinding ViewportWidth}"
|
||
|
Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}"
|
||
|
Value="{Binding HorizontalOffset,
|
||
|
Mode=OneWay,
|
||
|
RelativeSource={RelativeSource TemplatedParent}}" />
|
||
|
</Grid>
|
||
|
</Grid>
|
||
|
</ControlTemplate>
|
||
|
</ScrollViewer.Template>
|
||
|
<ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
|
||
|
</ScrollViewer>
|
||
|
|
||
|
</Border>
|
||
|
</ControlTemplate>
|
||
|
</Setter.Value>
|
||
|
</Setter>
|
||
|
<Style.Triggers>
|
||
|
<Trigger Property="IsGrouping" Value="True">
|
||
|
<Setter Property="ScrollViewer.CanContentScroll" Value="True" />
|
||
|
</Trigger>
|
||
|
</Style.Triggers>
|
||
|
</Style>
|
||
|
<BooleanToVisibilityConverter x:Key="bool2VisibilityConverter" />
|
||
|
<Style TargetType="{x:Type DataGridRowHeader}">
|
||
|
<Setter Property="Width" Value="25" />
|
||
|
<Setter Property="Template">
|
||
|
<Setter.Value>
|
||
|
<ControlTemplate TargetType="{x:Type DataGridRowHeader}">
|
||
|
<Grid>
|
||
|
<Microsoft_Windows_Themes:DataGridHeaderBorder Background="{TemplateBinding Background}"
|
||
|
BorderBrush="{TemplateBinding BorderBrush}"
|
||
|
BorderThickness="{TemplateBinding BorderThickness}"
|
||
|
IsHovered="{TemplateBinding IsMouseOver}"
|
||
|
IsPressed="{TemplateBinding IsPressed}"
|
||
|
IsSelected="{TemplateBinding IsRowSelected}"
|
||
|
Orientation="Horizontal"
|
||
|
Padding="{TemplateBinding Padding}"
|
||
|
SeparatorBrush="{TemplateBinding SeparatorBrush}"
|
||
|
SeparatorVisibility="{TemplateBinding SeparatorVisibility}">
|
||
|
<StackPanel Orientation="Horizontal">
|
||
|
<ContentPresenter VerticalAlignment="Center" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
|
||
|
<Control SnapsToDevicePixels="false"
|
||
|
Template="{Binding ValidationErrorTemplate,
|
||
|
RelativeSource={RelativeSource AncestorType={x:Type DataGridRow}}}"
|
||
|
Visibility="{Binding (Validation.HasError),
|
||
|
Converter={StaticResource bool2VisibilityConverter},
|
||
|
RelativeSource={RelativeSource AncestorType={x:Type DataGridRow}}}" />
|
||
|
</StackPanel>
|
||
|
</Microsoft_Windows_Themes:DataGridHeaderBorder>
|
||
|
</Grid>
|
||
|
</ControlTemplate>
|
||
|
</Setter.Value>
|
||
|
</Setter>
|
||
|
</Style>
|
||
|
</ResourceDictionary>
|