In my WPF Application I use the Field Chooser of the xamDataGrid. The user of the application uses a multi monitor configuration. On this configuration the Field Chooser pops up on an other montor than the main window.
How can I position the FieldChooser-Window ? I did some Test with the FieldChooserOpening event but without success.
Markus
Hello Markus,
I also tested this on a dual monitor machine and I was not able to reproduce this with the sample from the XamFeatureBrowser. What steps to do you perform to reproduce this?
You can manually position the ToolWindow that the FieldChooser is hosted with its Top, Left properties in the FieldChooserOpening event:
e.ToolWindow.Left = 100;
e.ToolWindow.Top = 100;
Hello Alex
Thanks for you answer. I didn't see it myself because I don't have a dual screen configuration. But I was told by the person that tests the application, that the field chooser opens on a different screen than the application.
One specialty is that the XamDataGrid is part of a user control. Perhaps this make the difference. Futhermore I don't use the newest version yet.
I will collect some more information about the problem
Best Regards
Markus,
If you can get more information on the environment and steps to reproduce the issue that would be great and we will test this again using the proper environment.
Hi Alex
I meanwhile did some further testing on a dual screen machine. On my machine the behaviour is like this: The FieldChooser initially seems to be opened on the same screen than the bigger part of the xamDataGrid. It is then opened at a fixed position on the corresponding screen (not relative to the grid). If the application window is moved to another screen, the FieldChooser pops up at the initial position which is now the "wrong" screen. I assume, that the FieldChooser Dialog is not realy closed but only hidden and no "repositioning" is done relative to the current location of the grid.
I think it would be better to position the FieldChooser relative to the grid or to the FieldChooser-Button.
Enclosed you find a sample application that shows the behaviour described. In this Application press the "Normal" button, so that a panel with a grid appears.
Sorry for the delayed response. I took a look at the code for the FieldChooser and the ToolWIndow is being reused and closing it just toggles its visiblity. There is no positioning code that we have for the FieldChooser.
What you can do is to get the Screen coordinates of the mouse, when you open the field chooser and set its position. This can be done in just three lines of code :
private void xdg_FieldChooserOpening(object sender, Infragistics.Windows.DataPresenter.Events.FieldChooserOpeningEventArgs e) { Point p1 = (e.Source as XamDataGrid).PointToScreen(Mouse.GetPosition(this)); e.ToolWindow.Top = p1.Y; e.ToolWindow.Left = p1.X; }
Thanks a lot for your answer and the sample code.