Tag

ColumnBase.PrintColumnHeaderStyle Property

Gets or sets the style applied to the column's header when the grid is printed. This is a dependency property.

Namespace: DevExpress.Xpf.Grid

Assembly: DevExpress.Xpf.Grid.v20.1.Core.dll

Declaration

public Style PrintColumnHeaderStyle { get; set; }
Public Property PrintColumnHeaderStyle As Style

Property Value

Type Description
Style

A Style object that represents the style applied to the column's header when the grid is printed.

Remarks

The PrintColumnHeaderStyle property specifies the style that groups together properties, resources, and event handlers and shares them between instances of the TextEdit type.

Target Type: TextEdit

To learn more, see Appearance Customization.

Example

This code example demonstrates how to customize Grid column's header when the grid is printed.

<Window
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid" 
        xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
        xmlns:dxgt="http://schemas.devexpress.com/winfx/2008/xaml/grid/themekeys"
        x:Class="PrintColumnHeaderStyle.MainWindow">
    <Window.Resources>

        <Style x:Key="printColumnHeaderStyle" BasedOn="{StaticResource {dxgt:TableViewThemeKey ResourceKey=DefaultPrintHeaderStyle}}" TargetType="dxe:TextEdit">
            <Setter Property="TextWrapping" Value="Wrap" />
            <Setter Property="Height" Value="Auto"/>
            <Setter Property="Padding" Value="10"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="dxe:TextEdit">
                        <dxe:TextEdit Margin="10" EditValue="{Binding Column.Header}" IsPrintingMode="True" TextWrapping="Wrap" Height="Auto"/>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

    </Window.Resources>
    <Grid>
        <dxg:GridControl Name="grid" Margin="0,25,0,0">
            <dxg:GridControl.Columns>
                <dxg:GridColumn FieldName="ID"/>
                <dxg:GridColumn FieldName="Name" Header="Name" PrintColumnHeaderStyle="{StaticResource printColumnHeaderStyle}">
                    <dxg:GridColumn.HeaderTemplate>
                        <DataTemplate>
                            <TextBlock TextWrapping="Wrap" Text="{Binding}"/>
                        </DataTemplate>
                    </dxg:GridColumn.HeaderTemplate>
                </dxg:GridColumn>
            </dxg:GridControl.Columns>
            <dxg:GridControl.View>
                <dxg:TableView ShowTotalSummary="True" Name="view"/>
            </dxg:GridControl.View>
        </dxg:GridControl>
        <Button Content="Button" VerticalAlignment="Top" Click="Button_Click"/>
    </Grid>
</Window>
See Also