Silverlight DataGrid - Adding columns at runtime
Asked Answered
B

1

0

I would like to be able to add / remove columns to my datagrid, based on UI inputs from the user.

Is this possible? Any good articles on this?

Thanks, Mark

Bullroarer answered 11/6, 2009 at 11:20 Comment(0)
L
0

Yes it is possible:

// Candidates is the DataGrid

var newColumn = new DataGridTextColumn() { Header="New Column"};
Candidates.Columns.Add(newColumn);
Candidates.Columns.Remove(newColumn);
Laundes answered 11/6, 2009 at 13:42 Comment(1)
This seems to work, but I'm always "one click behind". I suspect this is something to do with the updates not being updated on the UI Thread?Bullroarer

© 2022 - 2024 — McMap. All rights reserved.