如何DataGrid
在我的WPF
窗口中冻结我的列标题,以便当我向下滚动时,标题仍然可见。
[编辑]
这是我的XAML
:
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Visible">
<DataGrid Name="ModelsGrid" Background="Transparent" Foreground="Black" RowHeight="30" ColumnWidth="100" AutoGenerateColumns="False" ItemsSource="{Binding}">
<DataGrid.Columns>
<DataGridTextColumn Header="Property ID" Binding="{Binding Path=Id}" />
<DataGridTextColumn Header="Name" Width="Auto" Binding="{Binding Path=PropertyName}" />
<DataGridTextColumn Header="Description" Width="Auto" Binding="{Binding Path=Description}" />
<DataGridTextColumn Header="Access" Width="Auto" Binding="{Binding Path=Accessibility}" />
<DataGridTextColumn Header="Type" Width="Auto" Binding="{Binding Path=Type}" />
<DataGridTextColumn Header="Category" Width="Auto" Binding="{Binding Path=Category}" />
</DataGrid.Columns>
</DataGrid>
</ScrollViewer>
[编辑]
我只需要摆脱ScrollViewer
它,它就解决了。