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:
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.
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.
this is good. How about translating "File Chooser"?
serhiol said:this is good. How about translating "File Chooser"?
I don't understand your question. Where is "File Chooser?"
To translate any of the strings in NetAdvantage for WinForms, you use the ResourceCustomizer.
Customizing Assembly Resource Strings
Assembly Resource Strings
as I said before
the "Field Chooser" is the header string of the field chooser control.
Field chosser appears when I click on the grid button that selects what columns will be displayed and what not.
Ah, okay, you wrote "File" instead of "Field".
Anyway, you can change the text like so:
private void ultraGrid1_BeforeColumnChooserDisplayed(object sender, BeforeColumnChooserDisplayedEventArgs e) { e.Dialog.Text = "My text"; }
Thanks Mike Saltzman. This is exactly what I wanted.