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

TreeList.GetPrintPreviewText Event

Enables you to display custom text in preview sections when the control is printed.

Namespace: DevExpress.XtraTreeList

Assembly: DevExpress.XtraTreeList.v18.2.dll

Declaration

[DXCategory("Printing")]
public event GetPreviewTextEventHandler GetPrintPreviewText

Event Data

The GetPrintPreviewText event's data class is GetPreviewTextEventArgs. The following properties provide information specific to this event:

Property Description
Node Gets the current Tree List node. Inherited from NodeEventArgs.
PreviewText Gets or sets the preview text.

Remarks

The Tree List control’s printed version contains preview sections if the TreeListOptionsPrint.PrintPreview option is enabled. The TreeList.PreviewFieldName property and TreeList.GetPreviewText event specify the default contents of preview sections.

To provide custom text for preview sections when the control is printed, handle the GetPrintPreviewText event.

See the Print TreeList topic for details on printing the control.

Example

The code below handles the TreeList.GetPreviewText and TreeList.GetPrintPreviewText events. This is used to supply preview sections of the original and printed control with different content. Preview sections of the printed control get the same text arranged in two lines.

using DevExpress.XtraTreeList;

private void treeList1_GetPreviewText(object sender, GetPreviewTextEventArgs e) {
   e.PreviewText = "Office location: " + e.Node["Location"].ToString() + 
     "; Contact phone: " + e.Node["Phone"].ToString();
}

private void treeList1_GetPrintPreviewText(object sender, GetPreviewTextEventArgs e) {
   e.PreviewText = "Office location: " + e.Node["Location"].ToString() + 
     "\nContact phone: " + e.Node["Phone"].ToString();
}
See Also