How To Hide Certain column if User Choose filter,Sorting or Grouping in xtraGridView Devexpress Windows Form
I have done some thing like that
private void gridView1_GridMenuItemClick(object sender, GridMenuItemClickEventArgs e)
{
//WHEN TO DISPALY CLBAL COL AND WHEN NOT
if (e.DXMenuItem.Caption.Equals("Group By This Column") || e.DXMenuItem.Caption.Equals("Sort Ascending") || e.DXMenuItem.Caption.Equals("Sort Descending")
|| e.DXMenuItem.Caption.Equals("Group By This Column") || e.DXMenuItem.Caption.Equals("Show Auto Filter Row"))
{
gridColumn16.Visible = false;
}
else if (e.DXMenuItem.Caption.Equals("Clear Grouping") || e.DXMenuItem.Caption.Equals("Clear All Sorting"))
{
gridColumn16.Visible = true;
}
}
I have achieve grouping and sorting but how to know when user perform filtering from column header
You can use a GridView level events to customize grid layout when a filter is applied to the grid. For instance the ColumnFilterChanged event
gridView1.ColumnFilterChanged += (s, e) => { gridView1.Columns[0].Visible = false; };
However, this event should fire on any filter changes i.e. from code, from the auto filter row filter row and so on.
There is no universal way to find out what a UI element is caused filter changes, but you can use UI based events (like showing filter popup or activating an editor in a the auto filter row) to accomplisht this task.