Skip to main content

TreeList.GetPreviewText Event

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

Namespace: DevExpress.XtraTreeList

Assembly: DevExpress.XtraTreeList.v24.1.dll

NuGet Packages: DevExpress.Win.Navigation, DevExpress.Win.TreeList

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 to display the Location and Phone field values in preview sections.

The following image shows the results.

Preview - GetPreviewText

using DevExpress.XtraTreeList;

treeList1.OptionsView.ShowPreview = true;

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