调整 WPF 中 DataGrid 标题的大小
我应该在 WPF 中进行一些我不熟悉的小的图形更改。 在xaml 的 .cs 文件中有这段代码
<DataGrid x:Name="dtGridReads" AutoGenerateColumns="False"
VirtualizingStackPanel.IsVirtualizing="True"
VirtualizingStackPanel.VirtualizationMode ="Standard"
EnableColumnVirtualization="True"
EnableRowVirtualization="True"
ScrollViewer.IsDeferredScrollingEnabled="True"
CanUserReorderColumns="False" CanUserResizeColumns="False" CanUserSortColumns="True"
ItemsSource ="{Binding}" Block.TextAlignment="Center"
AlternatingRowBackground="LightGoldenrodYellow" RowBackground="White"
CanUserAddRows="False" CanUserDeleteRows="False" FrozenColumnCount="1"
GridLinesVisibility="None" Style="{StaticResource ConcensusDataGridStyle}">
</DataGrid>
,我发现我可以更改数据的 fontSize 。但是,我似乎找不到在哪里/如何使标题字体变小。我正在尝试节省空间并缩小 DataGrid,但我找不到在哪里可以使列变小,并且可以使第一行中的标题文本变小。谢谢。
编辑:好的,我发现我可以更改 DataGrid 中的 FontSize。
I'm supposed to make some small graphical changes in WPF which I am unfamiliar with. There is this code in the xaml
<DataGrid x:Name="dtGridReads" AutoGenerateColumns="False"
VirtualizingStackPanel.IsVirtualizing="True"
VirtualizingStackPanel.VirtualizationMode ="Standard"
EnableColumnVirtualization="True"
EnableRowVirtualization="True"
ScrollViewer.IsDeferredScrollingEnabled="True"
CanUserReorderColumns="False" CanUserResizeColumns="False" CanUserSortColumns="True"
ItemsSource ="{Binding}" Block.TextAlignment="Center"
AlternatingRowBackground="LightGoldenrodYellow" RowBackground="White"
CanUserAddRows="False" CanUserDeleteRows="False" FrozenColumnCount="1"
GridLinesVisibility="None" Style="{StaticResource ConcensusDataGridStyle}">
</DataGrid>
In the .cs file, I found I can change the fontSize for the data. However, I cannot seem to find where/how I would make the header font smaller. I'm trying to save real estate and shrink the DataGrid, but I can't find where to make the columns smaller, and text for the header in that first row smaller. Thanks.
Edit: Ok I found I can just change the FontSize in the DataGrid.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)