Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
20
How do I Close Column Chooser Programmatically?
posted

We have a Windows desktop application with several overlaying user controls, only one user control has Visible = true, at a time.

 

When I disable a user control that contains an UltraGrid that has already turned on the ShowColumnChooser(), the Column Chooser stays displayed even though it is not relevant to the newly activated user control.

 

How can I do the equivalent of UltraGrid.HideColumnChooser() or CloseColumnChooser()?

 

I can easily intercept the base.VisibleChanged event and check for false and set UltraGrid.Visible = false, but the ColumnChooser still stays.

 

Any clues?  Thanks.

Parents
No Data
Reply
  • 467610
    Offline posted

     Hi,

    It's a little odd that the grid doesn't have a HideColumnChooser method to go along with the ShowColumnChooser. You should probably  Submit an incident to Infragistics Developer Support and report that as a bug. 

    Anyway, in the mean time, what you can do is something like this: 

            ColumnChooserDialog columnChooserDialog = null;
            private void ultraGrid1_BeforeColumnChooserDisplayed(object sender, BeforeColumnChooserDisplayedEventArgs e)
            {
                this.columnChooserDialog = e.Dialog;
                this.columnChooserDialog.FormClosed += new FormClosedEventHandler(columnChooserDialog_FormClosed);
            }

            void columnChooserDialog_FormClosed(object sender, FormClosedEventArgs e)
            {
                this.columnChooserDialog = null;           
            }

     

    This basically gives you a reference to the columnChooserDialog that the grid is currently displaying. So when you hide the grid, you can check to see if columnChooserDialog is not null and if so, hide the ColumnChooserDialog by calling:

    this.columnChooserDialog.Close()

Children
No Data