0

我有一个非常愚蠢的问题要问你.. :P 我怎样才能在 DataGrid 标题下划线?

4

1 回答 1

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>
于 2009-04-07T11:09:04.817 回答