Scrollbar Annotations enable FlexGrid users to visualize target rows directly on the grid's scrollbar using small, colored markers. Each annotation represents specific data, such as validation errors, focused rows, search results, or custom user-defined highlights, helping users quickly locate them without manual scrolling.
The configuration for enabling and customizing scrollbar annotations is managed primarily through the ScrollBarAnnotationsInfo class.

All features of scrollbar annotation can be enabled through properties, by setting them in the Properties window as True.

When Scrollbar annotation is enabled, annotation markers appear on the scrollbar to represent rows that meet certain criteria.
| C# |
コードのコピー
|
|---|---|
| public bool Enabled { get; set; } | |
Enables tooltip displaying row’s information when the mouse hovers over an annotation marker.
| C# |
コードのコピー
|
|---|---|
| public bool ShowTooltips { get; set; } | |
Tracks user’s current focus position and displays it on the scrollbar.
| C# |
コードのコピー
|
|---|---|
| public bool ShowFocusedRow { get; set; } | |
Highlights the positions of selected rows along the scrollbar.
| C# |
コードのコピー
|
|---|---|
| public bool ShowSelectedRows { get; set; } | |
Locates invalid entries within large datasets.
| C# |
コードのコピー
|
|---|---|
| public bool ShowErrors { get; set; } | |
Displays markers for rows that match search results or other custom highlighting criteria.
| C# |
コードのコピー
|
|---|---|
| public bool ShowErrors { get; set; } | |
The ScrollToScrollBarAnnotation method allows developers to programmatically scroll the FlexGrid view to a specific annotation marker. This is useful for guided navigation, such as jumping to the next error or search result.
The method accepts a ScrollBarAnnotation object as a parameter.
| C# |
コードのコピー
|
|---|---|
|
private void Button_Click(object sender, EventArgs e) c1FlexGrid1.ScrollToScrollBarAnnotation(firstAnnotation); |
|
Users can customize scrollbar annotation when the grid raises the ScrollBarAnnotationsUpdated event. The event arguments provide access to the full list of annotations, allowing users to append new ones or modify existing markers. The following code demonstrates customizing Scrollbar annotation.
| C# |
コードのコピー
|
|---|---|
|
/// <summary> public class CustomAnnotation : ScrollBarAnnotation public CustomAnnotation( private void C1FlexGrid1_ScrollBarAnnotationsUpdated(object sender, ScrollBarAnnotationsUpdatedArgs e) var text = $"Custom annotation. Time: {DateTime.Now.ToLongTimeString()}"; // Important Note: if (customAnnotation == null) e.Annotations.Add(new CustomAnnotation(CustomAnnotationType.Custom2, |
|
In case updates are not reflected, users can force the grid to re-render its annotations after modifying them. The following code demonstrates how to refresh annotations by temporarily disabling and re-enabling the feature.
| C# |
コードのコピー
|
|---|---|
|
if (_flexGrid.ScrollBarAnnotationsInfo.Enabled) // Temporarily disable and re-enable the feature to force a refresh // Resume layout updates and trigger a redraw |
|