I am trying to prepopulate the column chooser with the columns in my DataGrid.
like this:
ColumnChooser chooserWindow = new ColumnChooser(this.ColorDataGrid);
chooserWindow.Resources.MergedDictionaries.Clear();
chooserWindow.ClearValue(ColumnChooser.StyleProperty);
ResourceDictionary rd = new ResourceDictionary();
foreach (var item in this.ColorDataGrid.Columns)
{
rd.Add(item.MappingName, item);
}
//Resources has been added to the Merged Dictionaries
chooserWindow.Resources.MergedDictionaries.Add(rd);
this.ColorDataGrid.GridColumnDragDropController = new GridColumnChooserController(this.ColorDataGrid, chooserWindow);
chooserWindow.Show();
But when the chooserWindow is open nothing is there, but if I drag and drop a column from the datagrid it works.
How would I go about populating this window?
Thanks.