I wonder how to implement in the WinGrid the column selection.
When a grid has a lot of columns, some columns should be hidded others, displayed, as user desires, like in the Windows Explorer in Details mode:
The easiest thing to do is use the Save and Load methods on the grid's DisplayLayout. You can save all user preferences to a file and then load them up again the next time the application loads.
Thanks Mike, Worked like a charm... Now is there a possibility to save the state of selected column for a user?
I mean, is it possible to
a) manipulate that list of visible columns by code? (I hope setting Column to Visible should be enough)
b) translate the "Field Chooser" header string of the field chooser control.
You could turn on the grid's built-in ColumnChooser dialog like so:
private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e) { UltraGridLayout layout = e.Layout; UltraGridOverride ov = layout.Override; ov.RowSelectors = DefaultableBoolean.True; ov.RowSelectorHeaderStyle = RowSelectorHeaderStyle.ColumnChooserButton; }
You could also call the ShowColumnChooser to show the column chooser without enabling the grid's built-in UI for it.
Or, you could use an UltraGridColumnChooser control and hook it up to the grid and display it in your own dialog or however you want.