windowsforms-202-controls-and-libraries-tree-list-feature-center-data-presentation-preview-sections.md
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.
To display preview sections, do the following:
Set the TreeListOptionsView.ShowPreview property to true , and then handle one of the following events to provide custom contents for preview sections:
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.
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();
}
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
Use the following members to specify preview section height:
TreeList.PreviewLineCount - Gets or sets the number of text lines in preview sections.
TreeListOptionsView.AutoCalcPreviewLineCount - Gets or sets whether the number of text lines in preview sections is calculated automatically depending on their contents.
TreeList.MeasurePreviewHeight - This event allows you to specify individual preview sections’ height in pixels.
See Also