我有一个数据网格,我想只将标题格式化为粗体,但我无法弄清楚放在哪里 我试过顶部标签:
<sdk:DataGrid AlternatingRowBackground="LightSteelBlue"
AutoGenerateColumns="False" Name="grdSearchResults"
RowBackground="Azure" Margin="12,9,12,12" Grid.Row="3"
Grid.ColumnSpan="3" FontWeight="SemiBold">
并且数据和标题变为粗体
我已尝试过列级
<sdk:DataGridTextColumn Binding="{Binding SystemSourceIdentifier}"
Header="System Source" Width="Auto" FontWeight="SemiBold"
/>
将数据设置为仅粗体
这是我的完整数据网格:
<sdk:DataGrid AlternatingRowBackground="LightSteelBlue"
AutoGenerateColumns="False" Name="grdSearchResults"
RowBackground="Azure" Margin="12,9,12,12"
Grid.Row="3" Grid.ColumnSpan="3" FontWeight="SemiBold">
<sdk:DataGrid.Columns>
<sdk:DataGridTextColumn Binding="{Binding SystemSourceIdentifier}"
Header="System Source" Width="Auto" />
<sdk:DataGridTextColumn Binding="{Binding TableName}" FontSize="11"
Header="Key Identifier" Width="Auto" />
<sdk:DataGridTextColumn Binding="{Binding KeyValue}" FontSize="11"
Header="Key Value" Width="Auto" />
<sdk:DataGridTemplateColumn CanUserReorder="False" CanUserResize="False"
CanUserSort="False" Header="View" IsReadOnly="False" Width="Auto">
<sdk:DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<StackPanel>
<HyperlinkButton Content="..." Name="btnOpen"
NavigateUri="{Binding UrlLink}"
Foreground="#FF000019"
TargetName="_blank" />
</StackPanel>
</DataTemplate>
</sdk:DataGridTemplateColumn.CellTemplate>
</sdk:DataGridTemplateColumn>
</sdk:DataGrid.Columns>
</sdk:DataGrid>
答案 0 :(得分:1)
尝试像这样添加DataGridColumnHeader样式
<UserControl.Resources>
<Style x:Key="DataGridColumnHeaderStyle" TargetType="sdk:DataGridColumnHeader">
<Setter Property="FontWeight" Value="SemiBold"/>
</Style>
</UserControl.Resources>
然后使用Datagrid的样式
<sdk:DataGrid ColumnHeaderStyle="{StaticResource DataGridColumnHeaderStyle}" ...>
或者你可以像这样设置DataGrid ColumnHeaderStyle中的值。
<sdk:DataGrid AlternatingRowBackground="LightSteelBlue" AutoGenerateColumns="False" Name="grdSearchResults" RowBackground="Azure" Margin="12,9,12,12" Grid.Row="3" Grid.ColumnSpan="3" FontWeight="SemiBold">
<sdk:DataGrid.ColumnHeaderStyle>
<Style TargetType="sdk:DataGridColumnHeader">
<Setter Property="FontWeight" Value="SemiBold"/>
</Style>
</sdk:DataGrid.ColumnHeaderStyle>
<sdk:DataGrid.Columns>...