Back to Devexpress

Preview Sections

windowsforms-202-controls-and-libraries-tree-list-feature-center-data-presentation-preview-sections.md

latest4.1 KB
Original Source

Preview Sections

  • Nov 13, 2018
  • 2 minutes to read

Preview sections are non-editable regions that allow nodes to display large memo text or custom data. They are displayed under nodes’ data cells across all columns.

Contents - Displaying Data from a Single Field

To display preview sections, do the following:

  1. Set the TreeListOptionsView.ShowPreview property to true.
  2. Set the TreeList.PreviewFieldName property to a field that automatically provides data for preview sections.

Custom Contents

Set the TreeListOptionsView.ShowPreview property to true , and then handle one of the following events to provide custom contents for preview sections:

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.

csharp
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();
}
vb
Imports DevExpress.XtraTreeList

treeList1.OptionsView.ShowPreview = True

Private Sub TreeList1_GetPreviewText(ByVal sender As Object, _
ByVal e As GetPreviewTextEventArgs) Handles TreeList1.GetPreviewText
   e.PreviewText = "Office Location: " + e.Node("Location") + "; Phone: " + e.Node("Phone")
End Sub

Height

Use the following members to specify preview section height:

Appearance

Printing API

See Also

Custom Drawing