Show/Hide Columns outside of RadGridView
This topic will show you how to choose which columns to be visible from outside of RadGridView.
There are several options available:
through ControlPanel
defining Header Context Menu
ListBox Outside RadGridView
The example will represent a ListBox and RadGridView. The ListBox will list the available columns for RadGridView and each of the items in this list will have a check box for determining the visibility of the column.
Here are the definitions of the controls.
Next bind the ListBox.ItemsSource to RadGridView.Columns collection via Element Binding.
After that define DataTemplate for ItemTemplate property of the ListBox. It should include a CheckBox and you can bind its IsChecked property to column.IsVisible property using TwoWay Data Binding.
Provide RadGridView with an appropriate data source and run your application. The result should be similar to this snapshot:
You can download a runnable project of the previous example from our online SDK repository: ColumnChooser.