Back to Devexpress

TreeList.CustomScrollAnnotation Event

windowsforms-devexpress-dot-xtratreelist-dot-treelist-91daa482.md

latest3.7 KB
Original Source

TreeList.CustomScrollAnnotation Event

Allows you to specify custom annotations.

Namespace : DevExpress.XtraTreeList

Assembly : DevExpress.XtraTreeList.v25.2.dll

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

Declaration

csharp
[DXCategory("Events")]
public event EventHandler<TreeListCustomScrollAnnotationsEventArgs> CustomScrollAnnotation
vb
<DXCategory("Events")>
Public Event CustomScrollAnnotation As EventHandler(Of TreeListCustomScrollAnnotationsEventArgs)

Event Data

The CustomScrollAnnotation event's data class is DevExpress.XtraTreeList.TreeListCustomScrollAnnotationsEventArgs.

Remarks

The CustomScrollAnnotation event allows you to provide data about custom annotations. Data is represented by the TreeListScrollAnnotationInfo type, which exposes the following properties.

  • Node — the node for which to show a scroll annotation
  • Color — color of the annotation

When handling this event, create data objects and add them to the Annotations collection in the event arguments.

csharp
private void treeList1_CustomScrollAnnotation(object sender, DevExpress.XtraTreeList.TreeListCustomScrollAnnotationsEventArgs e) {
    TreeListNode node = treeList1.FindNodeByFieldValue("DEPARTMENT", "Finance");
    e.Annotations = new List<TreeListScrollAnnotationInfo>();
    TreeListScrollAnnotationInfo info = new TreeListScrollAnnotationInfo() {
        Node = node,
        Color = Color.Orange
    };
    e.Annotations.Add(info);
}
vb
Private Sub treeList1_CustomScrollAnnotation(ByVal sender As Object, ByVal e As TreeListCustomScrollAnnotationsEventArgs) _
    Handles treeList1.CustomScrollAnnotation
    Dim node As TreeListNode = treeList1.FindNodeByFieldValue("DEPARTMENT", "Finance")
    e.Annotations = New List(Of TreeListScrollAnnotationInfo)()
    Dim info As New TreeListScrollAnnotationInfo() With {
        .Node = node,
        .Color = Color.Orange
    }
    e.Annotations.Add(info)
End Sub

The SetAnnotations method allows you to set annotations for a node array. Note that this method does not add annotations, but resets them.

csharp
private void treeList1_CustomScrollAnnotation(object sender, DevExpress.XtraTreeList.TreeListCustomScrollAnnotationsEventArgs e) {
    TreeListNode node = treeList1.FindNodeByFieldValue("DEPARTMENT", "Finance");
    e.SetAnnotations(Color.Red, node);
}
vb
Private Sub treeList1_CustomScrollAnnotation(ByVal sender As Object, ByVal e As TreeListCustomScrollAnnotationsEventArgs) _
    Handles treeList1.CustomScrollAnnotation
    Dim node As TreeListNode = treeList1.FindNodeByFieldValue("DEPARTMENT", "Finance")
    e.SetAnnotations(Color.Red, node)
End Sub

See Also

Scrollbar Annotations

CustomDrawScroll

TreeList Class

TreeList Members

DevExpress.XtraTreeList Namespace