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
2010-02-08 09:09:26
this tells me all the available columns, not which ones are currently visible...
Aran Mulholland
2010-02-08 22:30:43
i hope this time is clearer...
Natxo
2010-02-09 09:07:47
this tells you if a column is Visible, Collapsed or Hidden, it does not tell you if it currently on screen
Aran Mulholland
2010-03-05 03:21:36