The event handler receives an argument of type GetPreviewTextEventArgs containing data related to this event.
The following
GetPreviewTextEventArgs properties provide information specific to this event.
Property |
Description |
Node |
Gets the current Tree List node. |
PreviewText |
Gets or sets the preview text. |
The Tree List control's printed version contains Preview Sections if the TreeListOptionsPrint.PrintPreview option is enabled.
The PreviewFieldName property and 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 GetPreviewText and 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.
C# |
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();
}
|
VB |
Imports DevExpress.XtraTreeList
Private Sub TreeList1_GetPreviewText(ByVal sender As Object, _
ByVal e As GetPreviewTextEventArgs) Handles TreeList1.GetPreviewText
e.PreviewText = "Office location: " + e.Node("Location") + _
"; Contact phone: " + e.Node("Phone")
End Sub
Private Sub TreeList1_GetPrintPreviewText(ByVal sender As Object, _
ByVal e As GetPreviewTextEventArgs) Handles TreeList1.GetPrintPreviewText
e.PreviewText = "Office location: " + e.Node("Location") + _
vbCrLf + "Contact phone: " + e.Node("Phone")
End Sub
|