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

TreeList.GetPreviewText Event

Enables you to supply custom text for nodes’ preview sections.

Namespace: DevExpress.XtraTreeList

Assembly: DevExpress.XtraTreeList.v19.1.dll

Declaration

public event GetPreviewTextEventHandler GetPreviewText

Event Data

The GetPreviewText 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

To display custom text in preview sections, set the TreeListOptionsView.ShowPreview option to true and handle the GetPreviewText event. The GetPreviewText event fires repeatedly for each node. To supply custom text, assign it to the GetPreviewTextEventArgs.PreviewText event parameter.

Example

The sample code below handles the TreeList.GetPreviewText event. This is used to display values of the Location and Phone fields within preview sections of nodes.

The image illustrates the result of sample code execution.

Preview - GetPreviewText

using DevExpress.XtraTreeList;

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