Back to Devexpress

GridView.RefreshScrollAnnotations(ScrollAnnotationKind) Method

windowsforms-devexpress-dot-xtragrid-dot-views-dot-grid-dot-gridview-dot-refreshscrollannotations-x28-devexpress-dot-xtraeditors-dot-annotations-dot-scrollannotationkind-x29.md

latest2.8 KB
Original Source

GridView.RefreshScrollAnnotations(ScrollAnnotationKind) Method

Updates scrollbar annotations of the specified kind, and causes them to be redrawn.

Namespace : DevExpress.XtraGrid.Views.Grid

Assembly : DevExpress.XtraGrid.v25.2.dll

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

Declaration

csharp
public virtual void RefreshScrollAnnotations(
    ScrollAnnotationKind kind = ScrollAnnotationKind.All
)
vb
Public Overridable Sub RefreshScrollAnnotations(
    kind As ScrollAnnotationKind = ScrollAnnotationKind.All
)

Optional Parameters

NameTypeDefaultDescription
kindDevExpress.XtraEditors.Annotations.ScrollAnnotationKindAll

A kind of scrollbar annotations to update.

|

Remarks

Note

Show Me Run the Scrollbar Annotations & Bookmarks module in the XtraGrid MainDemo to see the complete example.

The code below updates custom scrollbar annotations for all rows.

csharp
bool ToggleBookmark(int handle) {
    int dataIndex = gridView.GetDataSourceRowIndex(handle);
    if(dataIndex < 0)
        return false;
    if(bookmarks.Contains(dataIndex))
        bookmarks.Remove(dataIndex);
    else
        bookmarks.Add(dataIndex);
    gridView.RefreshScrollAnnotations(ScrollAnnotationKind.Custom);
    gridView.InvalidateRow(handle);
    return true;
}
vb
Private Function ToggleBookmark(ByVal handle As Integer) As Boolean
    Dim dataIndex As Integer = gridView.GetDataSourceRowIndex(handle)
    If dataIndex < 0 Then
        Return False
    End If
    If bookmarks.Contains(dataIndex) Then
        bookmarks.Remove(dataIndex)
    Else
        bookmarks.Add(dataIndex)
    End If
    gridView.RefreshScrollAnnotations(ScrollAnnotationKind.Custom)
    gridView.InvalidateRow(handle)
    Return True
End Function

See Also

InvalidateScrollAnnotations()

GridView Class

GridView Members

DevExpress.XtraGrid.Views.Grid Namespace