Skip to content

Latest commit

 

History

History
48 lines (38 loc) · 2.5 KB

File metadata and controls

48 lines (38 loc) · 2.5 KB

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)