Skip to main content
A newer version of this page is available. .
Tag

ColumnBase.PrintCellStyle Property

Gets or sets the style applied to column cells when you print the GridControl or export it in the WYSIWYG mode. This is a dependency property.

Namespace: DevExpress.Xpf.Grid

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

NuGet Packages: DevExpress.WindowsDesktop.Wpf.Grid.Core, DevExpress.Wpf.Grid.Core

Declaration

public Style PrintCellStyle { get; set; }

Property Value

Type Description
Style

A Style object that represents the style applied to column cells when you print the GridControl or export it in the WYSIWYG mode.

Remarks

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

Target Type: TextEdit

Refer to the Print Data topic for more information on how to change printed cells appearance.

Example

This example shows how to create custom PrintCellStyle for grid columns to bring a custom printing appearance for PopupImageEdit, CheckBoxEdit and MemoEdit.

To learn more on how to implement similar functionality in Silverlight, refer to the T245823 example.

<Window x:Class="GridExample.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"       
        xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
        xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"
        xmlns:local="clr-namespace:GridExample" 
        Width="600" Height="350"
        >

    <Window.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/GridExample;component/Themes/PrintCellStylesWPF.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>        
    </Window.Resources>

    <Grid VerticalAlignment="Top">
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>

        <dxg:GridControl Name="grid" AutoGenerateColumns="AddNew">
            <dxg:GridControl.Columns>

                <dxg:GridColumn FieldName="PlainText"/>

                <dxg:GridColumn FieldName="MemoText" 
                                PrintCellStyle="{StaticResource MemoColumnPrintingStyle}"
                                >
                    <dxg:GridColumn.EditSettings>
                        <dxe:MemoEditSettings/>
                    </dxg:GridColumn.EditSettings>
                </dxg:GridColumn>

                <dxg:GridColumn FieldName="BooleanMember"
                                PrintCellStyle="{StaticResource CheckEditColumnPrintingStyle}"
                                > 
                    <dxg:GridColumn.EditSettings>
                        <dxe:CheckEditSettings/>
                    </dxg:GridColumn.EditSettings>
                </dxg:GridColumn>

                <dxg:GridColumn FieldName="Image"
                                PrintCellStyle="{StaticResource ImageColumnPrintingStyle}"
                                >
                    <dxg:GridColumn.EditSettings>
                        <dxe:PopupImageEditSettings/>
                    </dxg:GridColumn.EditSettings>
                </dxg:GridColumn>

            </dxg:GridControl.Columns>

            <dxg:GridControl.View>
                <dxg:TableView Name="view"/>
            </dxg:GridControl.View>         
        </dxg:GridControl>

        <Button Grid.Row="1" Width="150" Name="PrintButton" Click="PrintButton_Click" Content="Show print preview"/>
    </Grid>
</Window>
See Also