-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(style): add DataGrid.Small style
- Loading branch information
Showing
8 changed files
with
734 additions
and
882 deletions.
There are no files selected for viewing
267 changes: 29 additions & 238 deletions
267
src/Net_40/HandyControl_Net_40/Themes/Styles/DataGrid.xaml
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
240 changes: 240 additions & 0 deletions
240
src/Shared/HandyControl_Shared/Themes/Styles/Base/DataGridBaseStyle.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,240 @@ | ||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:hc="clr-namespace:HandyControl.Controls" | ||
xmlns:system="clr-namespace:System;assembly=mscorlib"> | ||
|
||
<Style x:Key="RowHeaderGripperStyle" TargetType="Thumb"> | ||
<Setter Property="Height" Value="8"/> | ||
<Setter Property="Background" Value="Transparent"/> | ||
<Setter Property="Cursor" Value="SizeNS"/> | ||
<Setter Property="Template"> | ||
<Setter.Value> | ||
<ControlTemplate TargetType="Thumb"> | ||
<Border Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}"/> | ||
</ControlTemplate> | ||
</Setter.Value> | ||
</Setter> | ||
</Style> | ||
|
||
<Style x:Key="DataGridCellStyle" TargetType="DataGridCell"> | ||
<Setter Property="FocusVisualStyle"> | ||
<Setter.Value> | ||
<Style> | ||
<Setter Property="Control.Template"> | ||
<Setter.Value> | ||
<ControlTemplate> | ||
<Rectangle Margin="2" Opacity=".6" SnapsToDevicePixels="true" Stroke="{DynamicResource SecondaryBorderBrush}" StrokeThickness="2" StrokeDashArray="1 1" RadiusX="4" RadiusY="4"/> | ||
</ControlTemplate> | ||
</Setter.Value> | ||
</Setter> | ||
</Style> | ||
</Setter.Value> | ||
</Setter> | ||
<Setter Property="Background" Value="Transparent"/> | ||
<Setter Property="BorderBrush" Value="Transparent"/> | ||
<Setter Property="BorderThickness" Value="0"/> | ||
<Setter Property="VerticalContentAlignment" Value="Center"/> | ||
<Setter Property="HorizontalContentAlignment" Value="Left"/> | ||
<Setter Property="Padding" Value="{StaticResource DefaultControlPadding}"/> | ||
<Setter Property="hc:BorderElement.CornerRadius" Value="{StaticResource DefaultCornerRadius}"/> | ||
<Setter Property="Template"> | ||
<Setter.Value> | ||
<ControlTemplate TargetType="DataGridCell"> | ||
<Border Background="Transparent"> | ||
<Border Margin="0,0,4,0" CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" Padding="{TemplateBinding Padding}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True"> | ||
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/> | ||
</Border> | ||
</Border> | ||
</ControlTemplate> | ||
</Setter.Value> | ||
</Setter> | ||
<Style.Triggers> | ||
<MultiDataTrigger> | ||
<MultiDataTrigger.Conditions> | ||
<Condition Binding="{Binding IsSelected,RelativeSource={RelativeSource Self}}" Value="true"/> | ||
<Condition Binding="{Binding SelectionUnit,RelativeSource={RelativeSource FindAncestor,AncestorType=DataGrid}}" Value="Cell"/> | ||
</MultiDataTrigger.Conditions> | ||
<Setter Property="Foreground" Value="{DynamicResource TextIconBrush}"/> | ||
<Setter Property="Background" Value="{DynamicResource PrimaryBrush}"/> | ||
</MultiDataTrigger> | ||
<MultiDataTrigger> | ||
<MultiDataTrigger.Conditions> | ||
<Condition Binding="{Binding IsSelected,RelativeSource={RelativeSource Self}}" Value="true"/> | ||
<Condition Binding="{Binding IsSelected,RelativeSource={RelativeSource AncestorType=DataGridRow}}" Value="False"/> | ||
<Condition Binding="{Binding SelectionUnit,RelativeSource={RelativeSource FindAncestor,AncestorType=DataGrid}}" Value="CellOrRowHeader"/> | ||
</MultiDataTrigger.Conditions> | ||
<Setter Property="Foreground" Value="{DynamicResource TextIconBrush}"/> | ||
<Setter Property="Background" Value="{DynamicResource PrimaryBrush}"/> | ||
</MultiDataTrigger> | ||
<MultiDataTrigger> | ||
<MultiDataTrigger.Conditions> | ||
<Condition Binding="{Binding IsSelected,RelativeSource={RelativeSource Self}}" Value="true"/> | ||
<Condition Binding="{Binding IsSelected,RelativeSource={RelativeSource AncestorType=DataGridRow}}" Value="True"/> | ||
<Condition Binding="{Binding SelectionUnit,RelativeSource={RelativeSource FindAncestor,AncestorType=DataGrid}}" Value="CellOrRowHeader"/> | ||
</MultiDataTrigger.Conditions> | ||
<Setter Property="Foreground" Value="{DynamicResource TextIconBrush}"/> | ||
</MultiDataTrigger> | ||
<MultiDataTrigger> | ||
<MultiDataTrigger.Conditions> | ||
<Condition Binding="{Binding IsSelected,RelativeSource={RelativeSource Self}}" Value="true"/> | ||
<Condition Binding="{Binding SelectionUnit,RelativeSource={RelativeSource FindAncestor,AncestorType=DataGrid}}" Value="FullRow"/> | ||
</MultiDataTrigger.Conditions> | ||
<Setter Property="Foreground" Value="{DynamicResource TextIconBrush}"/> | ||
</MultiDataTrigger> | ||
<MultiTrigger> | ||
<MultiTrigger.Conditions> | ||
<Condition Property="IsSelected" Value="true"/> | ||
<Condition Property="Selector.IsSelectionActive" Value="false"/> | ||
</MultiTrigger.Conditions> | ||
<Setter Property="Background" Value="{DynamicResource DarkDefaultBrush}"/> | ||
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/> | ||
</MultiTrigger> | ||
</Style.Triggers> | ||
</Style> | ||
|
||
<Style x:Key="DataGridRowStyle" TargetType="DataGridRow"> | ||
<Setter Property="Background" Value="{DynamicResource RegionBrush}"/> | ||
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/> | ||
<Setter Property="SnapsToDevicePixels" Value="true"/> | ||
<Setter Property="Margin" Value="0,0,0,4"/> | ||
<Setter Property="Padding" Value="0,6"/> | ||
<Setter Property="Validation.ErrorTemplate" Value="{x:Null}"/> | ||
<Setter Property="ValidationErrorTemplate"> | ||
<Setter.Value> | ||
<ControlTemplate> | ||
<TextBlock Foreground="Red" Margin="2,0,0,0" Text="!" VerticalAlignment="Center"/> | ||
</ControlTemplate> | ||
</Setter.Value> | ||
</Setter> | ||
<Setter Property="Template"> | ||
<Setter.Value> | ||
<ControlTemplate TargetType="DataGridRow"> | ||
<SelectiveScrollingGrid> | ||
<SelectiveScrollingGrid.ColumnDefinitions> | ||
<ColumnDefinition Width="Auto"/> | ||
<ColumnDefinition Width="*"/> | ||
</SelectiveScrollingGrid.ColumnDefinitions> | ||
<SelectiveScrollingGrid.RowDefinitions> | ||
<RowDefinition Height="*"/> | ||
<RowDefinition Height="Auto"/> | ||
</SelectiveScrollingGrid.RowDefinitions> | ||
<Border CornerRadius="4" Grid.ColumnSpan="2" x:Name="DGR_Border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True"/> | ||
<DataGridCellsPresenter MinHeight="{TemplateBinding MinHeight}" VerticalContentAlignment="Center" Grid.Row="0" Grid.Column="1" ItemsPanel="{TemplateBinding ItemsPanel}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/> | ||
<DataGridDetailsPresenter Margin="0,6" Grid.Column="1" Grid.Row="1" SelectiveScrollingGrid.SelectiveScrollingOrientation="{Binding AreRowDetailsFrozen, ConverterParameter={x:Static SelectiveScrollingOrientation.Vertical}, Converter={x:Static DataGrid.RowDetailsScrollingConverter}, RelativeSource={RelativeSource AncestorType=DataGrid}}" Visibility="{TemplateBinding DetailsVisibility}"/> | ||
<DataGridRowHeader Grid.Row="0" Grid.Column="0" SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical" Visibility="{Binding HeadersVisibility, ConverterParameter={x:Static DataGridHeadersVisibility.Row}, Converter={x:Static DataGrid.HeadersVisibilityConverter}, RelativeSource={RelativeSource AncestorType=DataGrid}}"/> | ||
</SelectiveScrollingGrid> | ||
</ControlTemplate> | ||
</Setter.Value> | ||
</Setter> | ||
<Style.Triggers> | ||
<Trigger Property="IsMouseOver" Value="true"> | ||
<Setter Property="Background" Value="{DynamicResource DarkDefaultBrush}"/> | ||
</Trigger> | ||
<Trigger Property="IsSelected" Value="True"> | ||
<Setter Property="Background" Value="{DynamicResource PrimaryBrush}"/> | ||
<Setter Property="TextElement.Foreground" Value="{DynamicResource TextIconBrush}"/> | ||
</Trigger> | ||
<MultiTrigger> | ||
<MultiTrigger.Conditions> | ||
<Condition Property="IsSelected" Value="true"/> | ||
<Condition Property="Selector.IsSelectionActive" Value="false"/> | ||
</MultiTrigger.Conditions> | ||
<Setter Property="Background" Value="{DynamicResource DarkDefaultBrush}"/> | ||
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/> | ||
</MultiTrigger> | ||
</Style.Triggers> | ||
</Style> | ||
|
||
<Style x:Key="ColumnHeaderGripperStyle" TargetType="Thumb"> | ||
<Setter Property="Width" Value="8"/> | ||
<Setter Property="Background" Value="Transparent"/> | ||
<Setter Property="Cursor" Value="SizeWE"/> | ||
<Setter Property="Template"> | ||
<Setter.Value> | ||
<ControlTemplate TargetType="Thumb"> | ||
<Border Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}"/> | ||
</ControlTemplate> | ||
</Setter.Value> | ||
</Setter> | ||
</Style> | ||
|
||
<Style x:Key="DataGridColumnHeaderStyle" TargetType="DataGridColumnHeader"> | ||
<Setter Property="VerticalContentAlignment" Value="Center"/> | ||
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/> | ||
<Setter Property="Padding" Value="12,0"/> | ||
<Setter Property="Template"> | ||
<Setter.Value> | ||
<ControlTemplate TargetType="DataGridColumnHeader"> | ||
<hc:SimplePanel> | ||
<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="Transparent" Padding="{TemplateBinding Padding}"> | ||
<Grid HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"> | ||
<Grid.ColumnDefinitions> | ||
<ColumnDefinition/> | ||
<ColumnDefinition Width="Auto"/> | ||
</Grid.ColumnDefinitions> | ||
<ContentPresenter RecognizesAccessKey="True" VerticalAlignment="Center" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/> | ||
<ToggleButton Grid.Column="1" VerticalAlignment="Center" Height="{x:Static system:Double.NaN}" Padding="4,0" Width="20" IsEnabled="False" Opacity="1" Foreground="{DynamicResource PrimaryBrush}" x:Name="ToggleButtonSortDirection" Style="{StaticResource ToggleButtonIconTransparent}" hc:IconSwitchElement.Geometry="{StaticResource DownGeometry}" hc:IconSwitchElement.GeometrySelected="{StaticResource UpGeometry}"/> | ||
</Grid> | ||
</Border> | ||
<Thumb x:Name="PART_LeftHeaderGripper" HorizontalAlignment="Left" Style="{StaticResource ColumnHeaderGripperStyle}"/> | ||
<Thumb x:Name="PART_RightHeaderGripper" HorizontalAlignment="Right" Style="{StaticResource ColumnHeaderGripperStyle}"/> | ||
</hc:SimplePanel> | ||
<ControlTemplate.Triggers> | ||
<Trigger Property="SortDirection" Value="{x:Null}"> | ||
<Setter Property="Visibility" Value="Collapsed" TargetName="ToggleButtonSortDirection"/> | ||
</Trigger> | ||
<Trigger Property="SortDirection" Value="Ascending"> | ||
<Setter Property="IsChecked" Value="True" TargetName="ToggleButtonSortDirection"/> | ||
</Trigger> | ||
<Trigger Property="SortDirection" Value="Descending"> | ||
<Setter Property="IsChecked" Value="False" TargetName="ToggleButtonSortDirection"/> | ||
</Trigger> | ||
</ControlTemplate.Triggers> | ||
</ControlTemplate> | ||
</Setter.Value> | ||
</Setter> | ||
<Style.Triggers> | ||
<Trigger Property="SortDirection" Value="Ascending"> | ||
<Setter Property="Foreground" Value="{DynamicResource PrimaryBrush}"/> | ||
</Trigger> | ||
<Trigger Property="SortDirection" Value="Descending"> | ||
<Setter Property="Foreground" Value="{DynamicResource PrimaryBrush}"/> | ||
<Setter Property="Foreground" Value="{DynamicResource PrimaryBrush}"/> | ||
</Trigger> | ||
</Style.Triggers> | ||
</Style> | ||
|
||
<Style x:Key="DataGridRowHeaderStyle" TargetType="DataGridRowHeader"> | ||
<Setter Property="Template"> | ||
<Setter.Value> | ||
<ControlTemplate TargetType="DataGridRowHeader"> | ||
<hc:SimplePanel HorizontalAlignment="Center"> | ||
<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="Transparent" Padding="{TemplateBinding Padding}" > | ||
<StackPanel Orientation="Horizontal"> | ||
<ContentPresenter RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="Center"/> | ||
</StackPanel> | ||
</Border> | ||
<Thumb x:Name="PART_TopHeaderGripper" Style="{StaticResource RowHeaderGripperStyle}" VerticalAlignment="Top"/> | ||
<Thumb x:Name="PART_BottomHeaderGripper" Style="{StaticResource RowHeaderGripperStyle}" VerticalAlignment="Bottom"/> | ||
</hc:SimplePanel> | ||
</ControlTemplate> | ||
</Setter.Value> | ||
</Setter> | ||
</Style> | ||
|
||
<Style x:Key="TextBlockComboBoxStyle" TargetType="ComboBox"> | ||
<Setter Property="Focusable" Value="True"/> | ||
<Setter Property="Template"> | ||
<Setter.Value> | ||
<ControlTemplate TargetType="ComboBox"> | ||
<TextBlock IsHitTestVisible="False" Text="{TemplateBinding Text}" TextTrimming="CharacterEllipsis"/> | ||
</ControlTemplate> | ||
</Setter.Value> | ||
</Setter> | ||
</Style> | ||
|
||
<Style x:Key="DataGridTextColumnStyle" TargetType="TextBlock"> | ||
<Setter Property="TextTrimming" Value="CharacterEllipsis"/> | ||
</Style> | ||
|
||
</ResourceDictionary> |
Oops, something went wrong.