windowsforms-devexpress-dot-xtratreelist-dot-treelist-91daa482.md
Allows you to specify custom annotations.
Namespace : DevExpress.XtraTreeList
Assembly : DevExpress.XtraTreeList.v25.2.dll
NuGet Packages : DevExpress.Win.Navigation, DevExpress.Win.TreeList
[DXCategory("Events")]
public event EventHandler<TreeListCustomScrollAnnotationsEventArgs> CustomScrollAnnotation
<DXCategory("Events")>
Public Event CustomScrollAnnotation As EventHandler(Of TreeListCustomScrollAnnotationsEventArgs)
The CustomScrollAnnotation event's data class is DevExpress.XtraTreeList.TreeListCustomScrollAnnotationsEventArgs.
The CustomScrollAnnotation event allows you to provide data about custom annotations. Data is represented by the TreeListScrollAnnotationInfo type, which exposes the following properties.
When handling this event, create data objects and add them to the Annotations collection in the event arguments.
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);
}
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.
private void treeList1_CustomScrollAnnotation(object sender, DevExpress.XtraTreeList.TreeListCustomScrollAnnotationsEventArgs e) {
TreeListNode node = treeList1.FindNodeByFieldValue("DEPARTMENT", "Finance");
e.SetAnnotations(Color.Red, node);
}
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