简体   繁体   中英

Silverlight DataGrid - Adding columns at runtime

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

Yes it is possible:

// Candidates is the DataGrid

var newColumn = new DataGridTextColumn() { Header="New Column"};
Candidates.Columns.Add(newColumn);
Candidates.Columns.Remove(newColumn);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM