GridView.CustomScrollAnnotation Event
Allows you to specify custom annotations.
Namespace: DevExpress.XtraGrid.Views.Grid
Assembly: DevExpress.XtraGrid.v24.1.dll
NuGet Packages: DevExpress.Win.Grid, DevExpress.Win.Navigation
Declaration
[DXCategory("Events")]
public event EventHandler<GridCustomScrollAnnotationsEventArgs> CustomScrollAnnotation
Event Data
The CustomScrollAnnotation event's data class is DevExpress.XtraGrid.Views.Grid.GridCustomScrollAnnotationsEventArgs.
Remarks
The CustomScrollAnnotation
event allows you to provide data about required custom annotations. Data is represented by the GridScrollAnnotationInfo
type that exposes the following properties:
RowHandle
— handle of the required row (see Row handles in the Rows topic);Color
— color of the mark on the scrollbar.
When handling the CustomScrollAnnotation
event, explicitly initialize the e.Annotations
collection, create data objects, and add them to the collection.
using using DevExpress.XtraGrid.Views.Grid;
void OnCustomScrollAnnotation(object sender, GridCustomScrollAnnotationsEventArgs e) {
e.Annotations = new List<GridScrollAnnotationInfo>();
GridScrollAnnotationInfo info = new GridScrollAnnotationInfo() { RowHandle = 74, Color = Color.Red };
e.Annotations.Add(info);
}
You can also use the e.SetAnnotations
method to set annotations for a row array.
void OnCustomScrollAnnotation(object sender, GridCustomScrollAnnotationsEventArgs e) {
int[] rowHandles = new int[] { 5, 17, 74 };
e.SetAnnotations(Color.Red, rowHandles);
}
Use the RefreshScrollAnnotations method to force the grid control to update/redraw scrollbar annotations.