feat: implementation for DataGrid.

This commit is contained in:
Dong Bin
2025-03-13 11:24:17 +08:00
parent 9aa24c066b
commit cf90be7cea
2 changed files with 9 additions and 5 deletions

View File

@@ -15,8 +15,9 @@
<TabItem Header="DataGrid">
<Grid RowDefinitions="Auto, *">
<StackPanel Grid.Row="0" Orientation="Horizontal">
<ToggleSwitch Content="Disable" Name="DisableToggle" />
<ToggleSwitch Content="ScrollViewerHide" Name="ScrollViewerHide" />
<ToggleSwitch Content="Enable" Name="enable" IsChecked="True" />
<ToggleSwitch Content="Inset Content" Name="inset" />
<ToggleSwitch Content="ScrollBar Auto Hide" Name="autohide"></ToggleSwitch>
</StackPanel>
<DataGrid Grid.Row="1"
Margin="8"
@@ -25,8 +26,9 @@
CanUserSortColumns="True"
HeadersVisibility="All"
IsReadOnly="True"
ScrollViewer.AllowAutoHide="{Binding #ScrollViewerHide.IsChecked}"
IsEnabled="{Binding #DisableToggle.IsChecked}"
Classes.InsetContent="{Binding #inset.IsChecked}"
ScrollViewer.AllowAutoHide="{Binding #autohide.IsChecked}"
IsEnabled="{Binding #enable.IsChecked}"
ItemsSource="{Binding GridData1}">
<DataGrid.Columns>
<DataGridTextColumn

View File

@@ -530,6 +530,7 @@
Name="PART_VerticalScrollbar"
Grid.Row="1"
Grid.Column="2"
AllowAutoHide="{Binding Path=(ScrollViewer.AllowAutoHide), RelativeSource={RelativeSource TemplatedParent}}"
Orientation="Vertical" />
<Grid
@@ -540,6 +541,7 @@
<ScrollBar
Name="PART_HorizontalScrollbar"
Grid.Column="1"
AllowAutoHide="{Binding Path=(ScrollViewer.AllowAutoHide), RelativeSource={RelativeSource TemplatedParent}}"
Height="{DynamicResource ScrollBarSize}"
Orientation="Horizontal" />
</Grid>
@@ -572,7 +574,7 @@
</Style>
</Style>
<Style Selector="^[(ScrollViewer.AllowAutoHide)=False]">
<Style Selector="^.InsetContent">
<Style Selector="^ /template/ DataGridRowsPresenter#PART_RowsPresenter">
<Setter Property="Grid.RowSpan" Value="1" />
<Setter Property="Grid.ColumnSpan" Value="2" />