Hi,
I have an ultra grid in which i have a column chooser. If i minimize the screen, the column chooser dialog box appear on desktop. If a restore my screen then also it do not appear at screen and stay located at desktop. Could any one please suggest how could i close column chooser dialog box if screen is minimized or focus is shifted to some other screen.
Hi Nidhi,
We tried this out, and were not able to reproduce the behavior. One reason we can think of why it would happen is if the grid isn't on a form. For example it has no parent, or it's being using in WPF or on a web page or something else that is not a Windows Form.
Does this fit the description of your application? If this information does not help you to resolve this, please provide a sample application that reproduces the issue and we will look into why it is happening.
Thanks for replying Mike. You are right, I have used ultra-grid in a user control and adding this user control on my SAP based form. Is there a way to control column chooser behavior?
I'm not familiar with SAP. But at a glance it looks like it's basically just a cloud platform. So that would not cause a problem, and neither would having the grid inside a UserControl.
The grid isn't doing anything complicated when it shows the ColumnChooser dialog. All it does is create a regular Windows Form and set it's Owner to the form that the grid is on. So the grid walks up the parent chain and tries to find a Form.
If it finds one, it will set the Owner on the ColumnChooser dialog. After that, if you minimize the owning form, the DotNet framekwork takes care of hiding any owned forms that the main form contains.
So the only reason why minimizing the main Form would not hide the ColumnChooser is if there is no Form. If you were using the grid in a WPF application, for example, the grid would be contained inside a Window and not a Form. If you were using the grid on a web page, the grid would be contained in a Document or a Page or something else that is not a form.
If that's the case, and you have no Form in your application, then you would have the same problem with any child dialogs and the issue you are experiencing here is not specific to the grid. The solution in that case would be for you to track when your main window/form/whatever is minimized and then hide or close the ColumnChooser dialog in code.
So there are two things you have to do:
1) Keep a reference to the dialog when it is shown. You can do this by hooking the BeforeColumnChooserDisplayed event of the grid and storing e.Dialog in a variable.
2) Trap and event that fires when your main form is minimized and then hide the dialog.
Thanks Mike your suggestion should solve my problem.