How can I close the Docking Window?

Docking/MDI for WPF Forum

Posted 2 months ago by shaswat soni
Version: 22.1.1

How can I close the Docking Window?, Also I tried to place a button inside the docking window, but it didn't get reflected on the UI, is there something I'm missing ?

<docking:DockingWindow Name="spMain"
Height="auto" Width="Auto">

<Grid Name="gridCtrl" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
Height="auto" Width="auto">
<WindowsFormsHost x:Name="winFormHost" HorizontalAlignment="Stretch"
VerticalAlignment="Stretch" Height="Auto" Width="Auto"

<Button x:Name="closeButton"
Height="5" Width="7"
Click="closeButton_Click" Margin="13,0,0,15"



[Modified 2 months ago]

Comments (1)

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


1) Each docking window has a CloseCommand property on it you can use.  Set your Button's Command property to "{Binding ElementName=spMain, Path=CloseCommand}".

2) Interop controls like WindowsFormsHost always render above WPF content in the same Window/Popup.  That is a design flaw (commonly called the airspace issue) by Microsoft of WPF in general and is unfortunately nothing we can control.  You need to arrange your Button to not overlap the WindowsFormsHost to have it be visible.

3) You should not be creating a docking:DockingWindow in the XAML since that is a base class.  You should only either be creating a docking:ToolWindow or docking:DocumentWindow instead, based on where it is.  Please see our Control Hierarchy documentation topic to learn how to do this properly, and all our samples show proper XAML.

Actipro Software Support

The latest build of this product (v22.1.2) 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.