/winforms-grid-toggle-row-visibility

Toggle row visibility in a Grid control.

Primary LanguageVisual Basic .NETOtherNOASSERTION

WinForms Data Grid - How to toggle row visibility

This example implements a RowVisibilityHelper helper class. Its HideRow and ShowRow methods allow you to hide/show the specified data row:

public class RowVisibilityHelper : Component {
    // ...
    public void HideRow(int dataSourceRowIndex) {
        if (!IsRowInvisible(dataSourceRowIndex))
            InvisibleRows.Add(dataSourceRowIndex);
        GridView.RefreshData();
    }
    public void ShowRow(int dataSourceRowIndex) {
        if (IsRowInvisible(dataSourceRowIndex))
            InvisibleRows.Remove(dataSourceRowIndex);
        GridView.RefreshData();
    }
    public void ToggleRowVisibility(int dataSourceRowIndex) {
        if (IsRowInvisible(dataSourceRowIndex))
            ShowRow(dataSourceRowIndex);
        else
            HideRow(dataSourceRowIndex);
    }
}

WinForms Data Grid - Toggle row visibility

Files to Review

Does this example address your development requirements/objectives?

(you will be redirected to DevExpress.com to submit your response)