DevExpress WPF GridControl | Q&A | Saatody | Amit Padhiyar
How to hide group panel from table view of GridControl?
You can hide group panel (filter panel or filter search panel) using ShowGroupPanel property. Set the value ShowGroupPanel = false will hide group panel from table view of GridControl.
ShowGroupPanel = false
How to add dynamic columns in GridControl?
You can add, remove and clear columns using Grid.Columns. For adding new column, You should use Grid,Columns.Add(new GridColumn()). For better understanding you can see the below first example:
Grid.Columns.Add(new GridColumn { FieldName = "Name", Visible = true });
Grid.Columns.Add(new GridColumn { FieldName = "Mobile", Visible = false });
Grid.Columns.Add(new GridColumn { FieldName = "Email", Visible = false });
Grid.Columns.Add(new GridColumn { FieldName = "Address", Visible = false });
Grid.Columns.Add(new GridColumn { FieldName = "Company", Visible = false });
Now if you want remove particular column then you should use Grid.Columns.Remove(Object) or Grid.Columns.RemoveAt(Index). Disclaimer: The columns must already have column object otherwise it may gives you an exception error. And also RemoveAt() index must be in valid range otherwise this will also gives you an exception error.
Grid.Columns.Remove(NameColumn);
Grid.Columns.RemoveAt(0);
But you want to clear all the columns, then you should use Grid.Columns.Clear() method. Follow the below example.
Grid.Columns.Clear();
Comments
Post a Comment