In default column chooser all columns are available but no checkbox. I want to similar thing in "UltraGridColumnChooser". In that I need all columns without checkbox but their is no property in ColumnChooserStyle.
Hi Bharat,
I'm a little confused by your question. The image you have on the left is not the default view of the UltraGridColumnChooser. It looks like you might have code in your application which is turning on the FilterRow for the grid's ColumnChooser Dialog. If so, then the solution would be to not do that.
My guess is that you are doing it in the grid's BeforeColumnChooserDisplayed event.
My question is that how can we remove the red box part from UltraGridColumnChooser (see attached screenshot).
I am adding sample for your better understanding.
Hi,
Okay, so as I thought, you are handling BeforeColumnChooserDisplayed and explicitly turning on the Filter Row.
So what you want is for the user to be able to filter by the column name, but not to filter by the visibility of the columns. Is that right
This is a little tricky. The ColumnChooser isn't really designed to show the filter row or to allow you to easily modify it on this level. But it can be done.
The first thing to understand about doing this is that the ColumnChooser is actually a Control that contains a WinGrid. But the grid inside the ColumnChooser does not have any columns created at the time BeforeColumnChooserDisplayed fires. So what you have to do is hook the grid's InitializeLayout and disable the filter cell from there.
Here's some modified code from your sample. I only added two lines of code to the ultraGrid1_BeforeColumnChooserDisplayed event to hook the InitializeLayout event of the grid inside the ColumnChooser. Everything else happens inside columnChooserGrid_InitializeLayout.
private void ultraGrid1_BeforeColumnChooserDisplayed(object sender, BeforeColumnChooserDisplayedEventArgs e) { ColumnChooserDialog dlg = new ColumnChooserDialog(); dlg.Owner = this; UltraGridColumnChooser cc = dlg.ColumnChooserControl; cc.SourceGrid = this.ultraGrid1; cc.CurrentBand = this.ultraGrid1.DisplayLayout.Bands[0]; cc.Style = ColumnChooserStyle.AllColumnsAndChildBandsWithCheckBoxes; cc.MultipleBandSupport = MultipleBandSupport.SingleBandOnly; dlg.Size = new Size(250, 300); dlg.ColumnChooserControl.DisplayLayout.Override.FilterUIType = FilterUIType.FilterRow; // Find the grid inside the column chooser and hook InitializeLayout. var columnChooserGrid = dlg.ColumnChooserControl.Controls["displayGrid"] as UltraGrid; columnChooserGrid.InitializeLayout += columnChooserGrid_InitializeLayout; dlg.Show(); e.Cancel = true; } void columnChooserGrid_InitializeLayout(object sender, InitializeLayoutEventArgs e) { UltraGridLayout layout = e.Layout; UltraGridBand band = layout.Bands[0]; // Turn off filtering on the "Visible" column. band.Columns["Visible"].FilterOperandStyle = FilterOperandStyle.None; UltraGridCell visibleFilterCell = layout.Rows.FilterRow.Cells["Visible"]; visibleFilterCell.Activation = Activation.Disabled; // Unhook the InitializeLayout event. We need to do this because the event will be // re-hooked inside of ultraGrid1_BeforeColumnChooserDisplayed, and we don't // want the event to be hooked multiple times. ((UltraGrid)sender).InitializeLayout -= columnChooserGrid_InitializeLayout; }
Yes Mike. You got my point, but I found my required UI based on your tricky solution.. :-)
Oh, so you want to hide the entire checkbox column? I thought you meant just the filter cell checkbox. :)
Again thanks Mike.I got my solution by adding one more lineband.Columns["Visible"].Hidden = true;
Hello Mike,Your provided solution is good for me. It would be great if I can show above header looks like this screenshot (Merging of "Visible" & "Value" header columns).