void initializeColumns() { foreach (var column in gridView.Columns) { var columnWithVisibility = new GridViewColumnWithVisibility { Column = column, IsVisible = true }; allColumns.Add(columnWithVisibility); columnWithVisibility.IsVisibleChanged += columnWithVisibility_IsVisibleChanged; } }
void initializeColumns() { foreach (var column in gridView.Columns) { // show / hide right in the beginning if supported bool isDefaultVisible = (column is GridViewHideableColumn) ? ((GridViewHideableColumn)column).IsVisibleDefault : true; // wrap into our ViewModel var columnWithVisibility = new GridViewColumnWithVisibility { Column = column, IsVisible = isDefaultVisible }; allColumns.Add(columnWithVisibility); columnWithVisibility.IsVisibleChanged += columnWithVisibility_IsVisibleChanged; } }