We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Cannot get the position of a document window

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


12 Replies

BA BagavathiPerumal Apranandham Syncfusion Team May 4, 2023 02:00 PM UTC

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}).");



Regards,
Bagavathi Perumal A



Attachment: DockingManager_FloatWindowPosition_40ac4100.zip


AT Alexander Tashkov May 5, 2023 06:17 AM UTC

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



BA BagavathiPerumal Apranandham Syncfusion Team May 11, 2023 03:16 PM UTC

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:

  • Please share the video to reproduce the reported issue.
  • If it is possible, please share the modified sample.



Regards,
Bagavathi Perumal A



AT Alexander Tashkov May 11, 2023 08:42 PM UTC

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


Attachment: Video_And_Sample_6c991315.zip


AT Alexander Tashkov May 11, 2023 08:52 PM UTC

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



BA BagavathiPerumal Apranandham Syncfusion Team May 12, 2023 02:44 PM UTC

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





BA BagavathiPerumal Apranandham Syncfusion Team May 22, 2023 10:53 AM UTC

Hi Alexander Tashkov,


Query2: Unable to get the correct position of the floating window.


Sorry for the delay in getting back to you.


We can be able to reproduce the issue from our end. We will check and update you on or before 24th May 2023. We appreciate your patience until then.



Regards,
Bagavathi Perumal A



BA BagavathiPerumal Apranandham Syncfusion Team May 24, 2023 05:05 PM UTC

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



BA BagavathiPerumal Apranandham Syncfusion Team May 26, 2023 06:15 AM UTC

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



BA BagavathiPerumal Apranandham Syncfusion Team May 30, 2023 03:39 PM UTC

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



RS Raghavendra Sudhakar Syncfusion Team June 20, 2023 01:09 PM UTC

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



BA BagavathiPerumal Apranandham Syncfusion Team June 30, 2023 01:59 PM UTC

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


Attachment: DockingManagerWPF_a7e48730.zip

Loader.
Up arrow icon