Hi,
is there a way to set a custom column order in the UltraGridColumnChooser?
We want to show the original display layout (which we backup before applying a new one).
Thanks,Michael
Hi Michael,
Thank you for posting in our forums!
As you already noticed, by default the ColumnChooser displays UltraGrid’s columns alphabetically. In order to change this behavior, you can follow the next steps.
Before column chooser dialog is displayed it adds an UltraGrid to its child controls. The way to access this UltraGrid is via handling BeforeColumnChooserDispayed event handler on your primary UltraGrid. Once you get ColumnChooser’s UltraGrid you can handle InitializeLayout event handler and then figure out how to customize the order of rows and columns.
For further reference, take a look at the attached sample application and let me know if it matches your requirements.
I use the UltraGridColumnChooser control. How to attach to the InitializeLayout event here?
The InitializeLayout event should be attached on the ColumnChooser’s dialog child control which is of type UltraGrid. This is the default inner control that is used for displaying ColumnChooser’s content.
You can find more details in the attached sample application of my previous post. Please let me know if have any additional questions.
I have one more question:
How to change the style for the gridcecolumnheaders & gridcells seperated from the source grid.
If this cannot be done by stylist, how to override the appearance?
In order to set UltraGrid column headers and cells appearances at the code behind programmatically, please take a look at the following tutorials:
Change Color of Column Headers in UltraGrid: Revision #2
Changing the Appearance of WinGrid Columns
Changing the Appearance of WinGrid Cells
Hi Ivaylo,
I only want to change the appearance of the UltraGridColumnChooser control:
However if want to override the displaylayout like overriding for a UltraGrid, the count of the columns is 0:
foreach (UltraGridColumn c in _columnChooser.DisplayLayout.Bands[0].Columns) { c.Header.Appearance.BackColor = Color.White; }
Can you please provide a sample for this?!
The UltraGrid which is the SourceGrid of the UltraGridColumnChooser should have a different layout.
Thank you for the reply.
The column chooser grid and the source grid synchronize their appearances. The only way to change this is to use the DrawFilter interface. You can see more information about this interface in the following link:
http://help.infragistics.com/Help/Doc/WinForms/2012.2/CLR4.0/html/Win_Draw_Filter.html
I have modified Ivo’s sample in order to demonstrate this approach.
Please let me know if you have any additional questions.
Any updates?
Best would be an example showing how to set the appearance of the columnchoosercontrol (i do not use the buildin-dialog) different from it sourcegrid (e.g. changin the background of the cellheaders)