feat:add AutoHide ToggleSwitch to DataGrid demo.

This commit is contained in:
Zhang Dian 2024-08-15 18:53:06 +08:00
parent a3ed11fa10
commit b80deac692
2 changed files with 10 additions and 6 deletions

View File

@ -14,7 +14,10 @@
<TabControl>
<TabItem Header="DataGrid">
<Grid RowDefinitions="Auto, *">
<ToggleSwitch Grid.Row="0" Content="Disable" Name="DisableToggle"></ToggleSwitch>
<StackPanel Grid.Row="0" Orientation="Horizontal">
<ToggleSwitch Content="Disable" Name="DisableToggle" />
<ToggleSwitch Content="ScrollViewerHide" Name="ScrollViewerHide" />
</StackPanel>
<DataGrid Grid.Row="1"
Margin="8"
CanUserReorderColumns="True"
@ -22,6 +25,7 @@
CanUserSortColumns="True"
HeadersVisibility="All"
IsReadOnly="True"
ScrollViewer.AllowAutoHide="{Binding #ScrollViewerHide.IsChecked}"
IsEnabled="{Binding #DisableToggle.IsChecked}"
ItemsSource="{Binding GridData1}">
<DataGrid.Columns>

View File

@ -471,7 +471,7 @@
<Setter Property="VerticalScrollBarVisibility" Value="Auto" />
<Setter Property="SelectionMode" Value="Extended" />
<Setter Property="GridLinesVisibility" Value="None" />
<Setter Property="ScrollViewer.AllowAutoHide" Value="True"></Setter>
<Setter Property="ScrollViewer.AllowAutoHide" Value="True" />
<Setter Property="HorizontalGridLinesBrush" Value="{DynamicResource DataGridLineBrush}" />
<Setter Property="VerticalGridLinesBrush" Value="{DynamicResource DataGridLineBrush}" />
<Setter Property="DropLocationIndicatorTemplate">
@ -574,11 +574,11 @@
<Style Selector="^[(ScrollViewer.AllowAutoHide)=False]">
<Style Selector="^ /template/ DataGridRowsPresenter#PART_RowsPresenter">
<Setter Property="Grid.RowSpan" Value="1"></Setter>
<Setter Property="Grid.ColumnSpan" Value="2"></Setter>
<Setter Property="Grid.RowSpan" Value="1" />
<Setter Property="Grid.ColumnSpan" Value="2" />
</Style>
<Style Selector="^ /template/ DataGridColumnHeadersPresenter#PART_ColumnHeadersPresenter">
<Setter Property="Grid.ColumnSpan" Value="1"></Setter>
<Setter Property="Grid.ColumnSpan" Value="1" />
</Style>
</Style>
</ControlTheme>