ColumnChooser

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.

3 Replies

DY Deivaselvan Y Syncfusion Team August 22, 2018 03:11 PM UTC

Hi Luke,

Thank you for contacting Syncfusion support.

In SfDataGrid, HiddenColumns only added to ColumnChooser window by default. If you have set Column.IsHidden is true, then those columns will be shown in ColumnChooser window otherwise columns will not be shown in chooser window and same scenario executes while loading also. So, if you want to show columns on loading, you need to set its IsHidden property to true.

Please refer below documentation link for more details 

https://help.syncfusion.com/wpf/sfdatagrid/interactive-features#columnchooser 

Refer the demo sample for the same from the below link.
https://github.com/syncfusion/wpf-demos/tree/master/SfGrid.WPF/Samples/ColumnChooserDemo/CS

Regards,
Deivaselvan 



AP Ashwini Paranthaman Syncfusion Team August 23, 2018 04:00 AM UTC

From: Nelson Martz 
Sent: Wednesday, August 22, 2018 5:03 PM
To: Syncfusion Support 
Subject: RE: Syncfusion support community forum 139387, ColumnChooser, has beenupdated. 

Well, one of my columns on the datagrid is hidden, but it still doesn’t show up in the column chooser window.  Am I missing something? 



DY Deivaselvan Y Syncfusion Team August 23, 2018 06:43 PM UTC

Hi Luke,

We are unable to reproduce the reported issue with the column chooser, can you please provide us the sample application to reproduce it from our end or modify our demo sample to reproduce it based on your scenario, thereby we could analyze and update you with the appropriate details at the earliest.

Regards,
Deivaselvan 


Loader.
Up arrow icon