views:

116

answers:

1

I want to allow the user to add a column and for that column to appear on screen. Is there a way to find which columns are currently on screen?

A: 

The property Columns of the Datagrid is an ObservableCollection<DataGridColumn>. You will find everithing you need there. If you want to know if any given column is visible, simply check MyDatagrid.Columns[i].Visibility

Adding columns in code is simple:

DataGridTemplateColumn col = new DataGridTemplateColumn();
MyDatagrid.Columns.Add(col);
Natxo
this tells me all the available columns, not which ones are currently visible...
Aran Mulholland
i hope this time is clearer...
Natxo
this tells you if a column is Visible, Collapsed or Hidden, it does not tell you if it currently on screen
Aran Mulholland