Skip to content

DevExpress-Examples/winforms-grid-toggle-row-visibility

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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)

Contributors 3

  •  
  •  
  •