[DevExpress Support Team: CLONED FROM T666010: I have a question about the WindowedDocumentUIService]
I have additional questions.
Most pop-ups work exactly the way you tell them.
However, some pop-ups bound to ItemSource in some DockLayoutManager still appear in the center of the main window.
Are windows that are dependent on the DockLayoutManager unable to do what I want?
WindowedDocumentUIService defined in a layout panel uses a window where DockLayoutManager is placed as owner
Answers approved by DevExpress Support
We have fixed the issue described in this ticket and will include the fix in our next maintenance update. To apply this solution before the official update, request a hotfix by clicking the corresponding link for product versions you require.
Note: Hotfixes may be unavailable for beta versions and updates that are about to be released.
- v18.2.3Download Official Update
Hello,
I've reproduced the issue in the attached project and passed this ticket to our developers for further investigation. We'll update the ticket once we have any news.
As a workaround, you can override the WindowedDocumentUIService.CreateWindow method as follows:
protected override IWindowSurrogate CreateWindow(object view) { IWindowSurrogate window = WindowProxy.GetWindowSurrogate(Activator.CreateInstance(WindowType)); UpdateThemeName(window.RealWindow); window.RealWindow.Content = view; if (SetWindowOwner) { var owner = LayoutTreeHelper.GetVisualParents(AssociatedObject).OfType<FloatingPaneWindow>().FirstOrDefault(); window.RealWindow.Owner = owner ?? Window.GetWindow(AssociatedObject); } Style windowStyle = GetDocumentContainerStyle(window.RealWindow, view, WindowStyle, WindowStyleSelector); InitializeDocumentContainer(window.RealWindow, Window.ContentProperty, windowStyle); window.RealWindow.WindowStartupLocation = this.WindowStartupLocation; return window; }
Thank you.
I will wait for your answer.
Are you going to give me additional answers to the above questions?
Hello,
Our developers are working on this issue. Currently, we cannot provide you with any time estimates as to when it will be fixed. At the same time, a fix for this issue may change the default inner DockLayoutManager behavior and bring Breaking Changes. As the fix may affect our customer's existing projects, we cannot introduce it in minor versions and will introduce it in the next major version 18.2. So, if the issue is urgent for you or you won't be able to upgrade to this version, I suggest that you use the workaround we previously provided. I've found that it's possible to simplify it in the following manner:
public class WindowedDocumentUIServiceEx : WindowedDocumentUIService { protected override IWindowSurrogate CreateWindow(object view) { var window = base.CreateWindow(view); if (SetWindowOwner) { var owner = LayoutTreeHelper.GetVisualParents(AssociatedObject).OfType<FloatingPaneWindow>().FirstOrDefault(); window.RealWindow.Owner = owner ?? Window.GetWindow(AssociatedObject); } return window; } }
I've modified the sample project to demonstrate the main idea of this approach.
Thanks,
Kirill
Just to follow up and clarify the issue you faced. Our WindowedDocumentUIService searches for the owner window when creating its own window. The issue occurs because when you make your nested View with WindowedDocumentUIService floating, this service identifies the root MainWindow it as the owner window instead of searching for the parent floating container. The workaround we posted changes this behavior and returns the parent floating container instead.
Thanks,
Kirill
Thank you for your kind reply.