Skip to content

Commit

Permalink
datagrid lines modifications
Browse files Browse the repository at this point in the history
  • Loading branch information
kikipoulet committed Dec 11, 2024
1 parent 6ab83c6 commit e8dcd17
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 39 deletions.
7 changes: 4 additions & 3 deletions SukiUI.Demo/Features/ControlsLibrary/CollectionsView.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,18 +68,19 @@
<suki:GroupBox Header="DataGrid">
<StackPanel>
<showMeTheXaml:XamlDisplay UniqueId="DataGrid">
<DataGrid MinWidth="350"
<DataGrid MinWidth="350"
MaxHeight="200"
CanUserResizeColumns="{Binding IsDataGridColumnsResizable}"
ItemsSource="{Binding DataGridContent}">
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding StringColumn}" Header="String" />
<DataGridTextColumn Binding="{Binding IntColumn}"
CellStyleClasses="RightAlign"

Header="Int" />
<DataGridCheckBoxColumn Binding="{Binding BoolColumn}"
CellStyleClasses="CenterAlign"

Header="Bool" />

</DataGrid.Columns>
</DataGrid>
</showMeTheXaml:XamlDisplay>
Expand Down
67 changes: 31 additions & 36 deletions SukiUI/Theme/DataGridStyle.axaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
<Styles xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Styles xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:objectModel="clr-namespace:System.Collections.ObjectModel;assembly=netstandard">
<Design.PreviewWith>
<Border Padding="20">
<DataGrid>
<DataGrid.Columns>

<DataGridTextColumn Binding="{Binding Name}" Header="Name" />

<DataGridTemplateColumn Header="Birthday">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<DatePicker BorderThickness="0" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>

</DataGrid.Columns>
<Border Background="White" Padding="20">
<DataGrid GridLinesVisibility="All" CanUserResizeColumns="True" Height="200" AutoGenerateColumns="True">
<DataGrid.ItemsSource>
<objectModel:ObservableCollection x:TypeArguments="DataGridCell">
<DataGridCell HorizontalAlignment="Left"></DataGridCell>
<DataGridCell HorizontalAlignment="Left"></DataGridCell>
<DataGridCell HorizontalAlignment="Left"></DataGridCell>
</objectModel:ObservableCollection>
</DataGrid.ItemsSource>
</DataGrid>
</Border>
</Design.PreviewWith>
Expand All @@ -27,7 +22,7 @@
<ControlTemplate>
<Grid Background="{TemplateBinding Background}" ColumnDefinitions="*,Auto">
<ContentPresenter Margin="{TemplateBinding Padding}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="Center"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
Expand All @@ -37,7 +32,7 @@
Grid.Column="1"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Stroke="WhiteSmoke"
Stroke="{DynamicResource SukiBorderBrush}"
StrokeThickness="1" />
</Grid>
</ControlTemplate>
Expand Down Expand Up @@ -81,8 +76,8 @@
ContentTemplate="{TemplateBinding ContentTemplate}" />
<Path Name="SortIcon"
Grid.Column="1"
Width="8"
Margin="4,0,0,0"
Width="10"
Margin="8,0,8,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Data="F1 M -5.215,6.099L 5.215,6.099L 0,0L -5.215,6.099 Z "
Expand All @@ -101,7 +96,7 @@
</Style>

<Style Selector="DataGrid[CanUserResizeColumns=True] DataGridColumnHeader:not(#PART_TopRightCornerHeader) /template/ Border#PART_Border">
<Setter Property="BorderThickness" Value="0,0,1,1.5" />
<Setter Property="BorderThickness" Value="0,0,0,1.5" />
</Style>

<Style Selector="DataGridColumnHeader:dragIndicator">
Expand Down Expand Up @@ -154,8 +149,8 @@
DataGridFrozenGrid.IsFrozen="True" />
<DataGridCellsPresenter Name="PART_CellsPresenter"
Grid.Row="0"
Grid.Column="1"
Margin="6"
Grid.Column="1"
Margin="6,0"
DataGridFrozenGrid.IsFrozen="True" />
<DataGridDetailsPresenter Name="PART_DetailsPresenter"
Grid.Row="1"
Expand Down Expand Up @@ -300,8 +295,8 @@
<Setter Property="HorizontalScrollBarVisibility" Value="Auto" />
<Setter Property="VerticalScrollBarVisibility" Value="Auto" />
<Setter Property="SelectionMode" Value="Extended" />
<Setter Property="HorizontalGridLinesBrush" Value="WhiteSmoke" />
<Setter Property="VerticalGridLinesBrush" Value="WhiteSmoke" />
<Setter Property="HorizontalGridLinesBrush" Value="Transparent" />
<Setter Property="VerticalGridLinesBrush" Value="{DynamicResource SukiBorderBrush}" />
<Setter Property="BorderBrush" Value="Gray" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="DropLocationIndicatorTemplate">
Expand All @@ -312,15 +307,15 @@
<Setter Property="Template">
<ControlTemplate>
<Border Background="Transparent" BorderThickness="0">
<Grid ColumnDefinitions="Auto,*,Auto" RowDefinitions="Auto,*,Auto,Auto">
<Grid.Styles>
<Style Selector="DataGrid /template/ Border > Grid:pointerover ScrollBar#PART_VerticalScrollbar">
<Setter Property="AllowAutoHide" Value="True"></Setter>
</Style>
<Style Selector="DataGrid /template/ Border > Grid:pointerover ScrollBar#PART_HorizontalScrollbar">
<Setter Property="AllowAutoHide" Value="True"></Setter>
</Style>
</Grid.Styles>
<Grid ColumnDefinitions="Auto,*,Auto" RowDefinitions="Auto,*,Auto,Auto">
<Grid.Styles>
<Style Selector="DataGrid /template/ Border > Grid:pointerover ScrollBar#PART_VerticalScrollbar">
<Setter Property="AllowAutoHide" Value="True"></Setter>
</Style>
<Style Selector="DataGrid /template/ Border > Grid:pointerover ScrollBar#PART_HorizontalScrollbar">
<Setter Property="AllowAutoHide" Value="True"></Setter>
</Style>
</Grid.Styles>

<DataGridColumnHeader Name="PART_TopLeftCornerHeader"
Grid.Row="0"
Expand All @@ -341,7 +336,7 @@
Fill="Transparent"
StrokeThickness="1" />

<DataGridRowsPresenter Name="PART_RowsPresenter"
<DataGridRowsPresenter Name="PART_RowsPresenter"
ClipToBounds="True"
Grid.Row="1"
Grid.Column="0"
Expand All @@ -357,7 +352,7 @@
Grid.Row="1"
HorizontalAlignment="Right" />

<Grid Grid.Column="1"
<Grid Grid.Column="1"
Grid.ColumnSpan="2"
Grid.Row="2"
ColumnDefinitions="Auto,*">
Expand Down

0 comments on commit e8dcd17

Please sign in to comment.