Version

Prevent Columns from Being Hidden

Please note that this control has been retired and is now obsolete to the XamDataGrid control, and as such, we recommend migrating to that control. It will not be receiving any new features, bug fixes, or support going forward. For help or questions on migrating your codebase to the XamDataGrid, please contact support.

If you enable the column chooser functionality or if you programmatically display the column chooser, your end users will be able to a hide a column using one of the following methods:

  • Click the column chooser icon on the column’s header.

  • From the column chooser dialog window, select the column’s corresponding check box.

However, you can prevent your end users from hiding a column altogether by setting the ColumnBase object’s IsHideable to False. By default, this property is set to True. When this property is set to False, the column chooser icon will not appear in that particular column’s header and the checkbox in the column chooser dialog will be disabled.

Note
Note:

This is strictly a UI limiting property, you can still change the visibility in the code-behind.

In the following screenshot, the CategoryID column is disabled.

xamGrid columnChooser6.png

The following example code demonstrates how to prevent columns from being hidden.

In XAML:

<ig:TextColumn IsHideable=" Key="CategoryID"/>

In C#:

this.MyDataGrid.Columns.DataColumns["CategoryID"].IsHideable = false;

In Visual Basic:

Me.MyDataGrid.Columns.DataColumns("CategoryID").IsHideable = True