我有一个非常愚蠢的问题要问你......:P 我该如何为DataGrid标题加下划线?
答案 0 :(得分:2)
<Window
x:Class="Test.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:dg="clr-namespace:Microsoft.Windows.Controls;assembly=WPFToolkit"
xmlns:dgp="clr-namespace:Microsoft.Windows.Controls.Primitives;assembly=WPFToolkit"
Title="Window1" Height="300" Width="300">
<Window.Resources>
<Style TargetType="dgp:DataGridColumnHeader">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="dgp:DataGridColumnHeader">
<Label>
<Underline>
<ContentPresenter/>
</Underline>
</Label>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Window.Resources>
<Grid>
<dg:DataGrid>
<dg:DataGrid.Columns>
<dg:DataGridTextColumn Header="No." Width="50">
</dg:DataGridTextColumn>
</dg:DataGrid.Columns>
</dg:DataGrid>
</Grid>
</Window>