"Cannot place windows in MDI since no MDI host (TabbedMdiHost, StandardMdiHost, etc.) was located"

Docking/MDI for WPF Forum

Posted 11 months ago by Andrea
Version: 23.1.2
Platform: .NET 6.0
Environment: Windows 11 (64-bit)
Avatar

v20.1.1

Hello, A customer is seeing this issue and we're not able to reproduce it. Would you be able to give some guidance about what we might be doing wrong or how this error could occur? 

System.InvalidOperationException: Cannot place windows in MDI since no MDI host (TabbedMdiHost, StandardMdiHost, etc.) was located as the direct child of the DockSite's Workspace.
   at ActiproSoftware.Internal.ap.yDT(DockingWindow  , DockHost  , DockingWindowState  , Nullable`1  )
   at ActiproSoftware.Internal.ap.KDo(DockingWindow  , IDockTarget  , Nullable`1  , Nullable`1  , Int32  )
   at ActiproSoftware.Internal.ap.Activate(DockingWindow window, Boolean focus)
   at ActiproSoftware.Windows.Controls.Docking.DockingWindow.Activate(Boolean focus)
   at ES.Ds.GUI.Production.Scripting.ScriptEditorWnd.AddTab(ScriptEditorDocument document)
            <docking:DockSite Name="m_scriptEditorDockSite" Padding="0" Background="{StaticResource paneBackgroundBrush}" CanDocumentWindowsFloat="False" CanDocumentWindowsDragToLinkedDockSites="False" KeyDown="OnKeyDown">
                <docking:Workspace>
                    <docking:TabbedMdiHost AllowDrop="False">
                        <docking:TabbedMdiContainer>
                        </docking:TabbedMdiContainer>
                    </docking:TabbedMdiHost>
                </docking:Workspace>
            </docking:DockSite>
        private void AddTab(ScriptEditorDocument document)
        {
            if (m_scriptEditorDockSite.IsVisible)
            {
                document.Activate();
            } else
            {
                document.Open();
            }
        }

[Modified 11 months ago]

Comments (1)

Posted 11 months ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Andrea,

In the XAML you have, you should not include the TabbedMdiContainer control.  An empty (no child) TabbedMdiHost should be enough there and TabbedMdiContainers are created/destroyed as needed based on layout changes.

Back on the original error, that should only ever happen if there was no TabbedMdiHost or StandardMdiHost as a child of the Workspace in the DockSite.  The XAML you give should work fine and should never see that error.  Perhaps you have some code somewhere else that is altering the control hierarchy or possibly removing the MDI host as a child of the Workspace somehow?


Actipro Software Support

The latest build of this product (v24.1.2) was released 8 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.