Hi,
I have a DockingManager in TDI mode. When dragging and making it floating outside the main application window, how can I get its position on the screen?
If, for example, the application runs on a multi-monitor system, and I need to show some message window, I would like it to be positioned within the bounding box of the currently active document window, which could be on a different monitor than the main application window.
Thanks for your help,
Best regards,
Alexander
Hi Alexandar Tashkov,
We suggest you to use the GetFloatingWindowRect() method to get the current position of the floating window. Please refer to the attached sample for your reference.
CodeSnippets:
Rect windowRect = DockingManager.GetFloatingWindowRect(activeContent);
MessageBox.Show($"The floating window position is ({windowRect.X}, {windowRect.Y}) and its size is ({windowRect.Width}, {windowRect.Height}).");
Hi Bagavathi,
Thank you for your reply. Unfortunately, I can't get it to work:
if (dockItem.State == DockState.Float)
{
Rect rect = DockingManager.GetFloatingWindowRect(dockItem);
}
rect is "empty" in the example above.
I have also tried to pass in the UserControl, that is contained within the DockItem. The result is the same - rect is empty.
Both DockItem and UserControl ARE DependencyObjects, so I don't understand what am I doing wrong.
What should I pass to the GetFloatingWindowRect in order for it to return a valid result?
Best regards,
Alexander
Hi Alexander Tashkov,
In the previously shared sample, the active window returns the selected tab from the document tab instead of the active floating window. As a result, we cannot obtain the correct position. If the active window returned the active floating window, we would be able to obtain the correct position. We will log this as a bug. And we will provide a feedback link for the bug report shortly.
Could you please confirm whether you are using the previously shared sample or any other sample. If you are not using the previously shared sample, please provide the following details. This information will help us provide a prompt solution:
Regards,
Bagavathi Perumal A
Hi Bagavathi,
Thanks again for your message.
Thank you also for the hint about the problem with the ActiveWindow property; will await the correction.
Currently I have 2 problems with the GetFloatingWindowRect() method:
- in the attached video (the application is the sample you submitted) you will see something strange: the method returns not the current position of the window, but the one before the current. This happens in a specific situation - when you work in a remote session on multi-monitor configuration (I have tested it with 2 and 3 monitors).
- the second problem: according to the documentation GetFloatingWindowRect() accepts a DependencyObject as a parameter. Yet, if I submit a DockItem (which derives from DependencyObject) or an UserControl (also a DependencyObject ancestor) the returned Rect object is always "empty", as described in the previous post. That way, it is not possible to get the position of a floating window that is not the ActiveWindow at the moment. I am attaching a sample app for the described behavior, too.
Hope this to be helpful to you.
Best regards,
Alexander
Hi again,
Sorry, correction to the first problem above: this happens ALWAYS when working in a remote session, also on a single monitor.
Best regards
Alexander
Hi Alexander Tashkov,
Query1: ActiveWindow is not updated properly in the DockingManager when
floating the DocumentTab
We have confirmed the reported scenario is a defect and
logged a report for the reported scenario “ActiveWindow is not updated properly
in the DockingManager when floating the DocumentTab”. We will provide the fix in the Weekly
NuGet release on May 30, 2023.
You can track the status of this defect using
the following feedback link: ActiveWindow
is not updated properly in the DockingManager when floating the DocumentTab in
WPF | Feedback Portal (syncfusion.com)
If you have any more specification replication procedures or a scenario to be tested, you can add it as a comment in the portal.
Please let us know if you need any further
assistance.
Note: The provided feedback link is private, and
you need to log in to view this feedback.
Query2: Unable to get the correction position of the floating window.
We are validating your reported issue. We will validate and update you on or before 16th May 2023.
Regards,
Bagavathi Perumal A
Hi Alexander Tashkov,
Query2: Unable to get the correct position of the floating window.
Regards,
Bagavathi Perumal A
Hi Alexander Tashkov,
Query2: Unable to get the correct position of the floating window.
We can be able to reproduce the issue from our end. We will share the bug reported shortly.
Regards,
Bagavathi Perumal A
Hi Alexander Tashkov,
We have confirmed the reported scenario is a defect and logged a report for the reported scenario “Unable to get the correct position of the floating window in DockingManager”. We will provide the fix in the Weekly NuGet release on June 20, 2023.
You can
track the status of this defect using the following feedback link:
Unable to get the correct position of the
floating window in DockingManager in WPF | Feedback Portal (syncfusion.com)
If you have any more specification replication procedures or a scenario to be tested, you can add it as a comment in the portal.
Please let
us know if you need any further assistance.
Note: The
provided feedback link is private, and you need to log in to view this feedback.
Regards,
Bagavathi Perumal A
Hi Alexander Tashkov,
We have included the fix for the reported issue “ActiveWindow is not updated properly in the DockingManager when floating the DocumentTab” in our Weekly NuGet release version v21.2.8 which is available for download ( https://www.nuget.org/).
We thank you for your support and appreciate your patience in waiting for this update. Please get in touch with us if you require any further assistance.
Regards,
Bagavathi Perumal A
Hi Alexander Tashkov,
Sorry for the inconvenience,
We have fixed the reported issue. We will include this fix in our upcoming nuget release, which is scheduled after our Vol. 2 release. We will appreciate your patience until then.
Regards,
Raghavendra S
Hi Alexander Tashkov,
We have included the fix for the reported issue “Unable to get the correct position of the floating window in DockingManager” in our Weekly NuGet release version v22.1.36 which is available for download (https://www.nuget.org/).
To retrieve the position of a DockItem within the DockingManager, you can use the dockItem.Content.Parent. This allows you to obtain the position of the DockItem when it has content present, as the position can only be retrieved from a ContentControl. Similarly, if you want to obtain the position of a UserControl, you can use usercontrol.Parent. Please refer to the attached sample and video for your reference.
Regards,
Bagavathi Perumal A