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

Docking/MDI for WPF Forum

Posted 1 year 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 1 year ago]

Comments (1)

Posted 1 year 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.3) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.