C# 将列表视图组标题文本更改为粗体



我设置了ListViewGroup标头的ListView控件。我想将组标题的文本设置为粗体。有没有其他选择来实现这一点?

使用粗体从项目创建临时字体

##

using(Font f= new Font(listView1.Items(0).SubItems(0).Font, FontSytle.Bold))

{

}

您可以使用以下 xaml

<ListView Name="lvUsers">
<ListView.GroupStyle>
<GroupStyle>
<GroupStyle.HeaderTemplate>
<DataTemplate>
<TextBlock FontWeight="Bold" FontSize="14" Text="{Binding Name}"/>
</DataTemplate>
</GroupStyle.HeaderTemplate>
</GroupStyle>
</ListView.GroupStyle>
</ListView>

最新更新