Dynamic Columns in a DataGrid

Mar 22, 2010 at 6:19 PM


I've got a project where I won't know until RunTime what columns the user wants to display are.

So I am trying to bind the Columns collection of a DataGrid to a Collection of DataGridColumns in the ViewModel but the Column collection is readonly.

Is there any MVVM friendly way to achiveing this or should I just listen to the changes in the collection in the viewmodel in the codebehind and add / remove columns as nessesary?