WPF C# DataGrid 字体大小设置指南:内容和标题
DataGrid的字体大小和标题字体大小可以通过样式来设置。
1. 设置DataGrid的内容字体大小:
在DataGrid中添加以下样式:
<DataGrid>
<DataGrid.Resources>
<Style TargetType="DataGridCell">
<Setter Property="FontSize" Value="16"/>
</Style>
</DataGrid.Resources>
</DataGrid>
其中,TargetType 指定样式的目标类型为 DataGridCell,Setter 中的属性为 FontSize,值为 16。
2. 设置DataGrid的标题字体大小:
在DataGrid中添加以下样式:
<DataGrid>
<DataGrid.ColumnHeaderStyle>
<Style TargetType="DataGridColumnHeader">
<Setter Property="FontSize" Value="20"/>
</Style>
</DataGrid.ColumnHeaderStyle>
</DataGrid>
其中,TargetType 指定样式的目标类型为 DataGridColumnHeader,Setter 中的属性为 FontSize,值为 20。
原文地址: https://www.cveoy.top/t/topic/kfTj 著作权归作者所有。请勿转载和采集!