Sometimes it is necessary to get reference to the floating Window object that is created when dockable window is placed into the floating state so you can change the properties on Window, like show-in-task-bar or change its minimum size.

To access floating Window in WPF Dock control follow these steps:

1. Handle DockSite.AfterDocked event
2. Detect your dock window and ensure that it is in floating state
3. Use Window.GetWindow method to retrieve reference to the floating Window instance

Following code shows how to set MinWidth and MinHeight properties on floating Window:

C#:

void MyDockSite_AfterDocked(object sender, DockRoutedEventArgs e)
{
    if (e.DockControl is DockWindowGroup)
    {
        DockWindowGroup dg = e.DockControl as DockWindowGroup;
        if (dg.IsFloating)
        {
            Window w = Window.GetWindow(dg);
            w.MinHeight = 200;
            w.MinWidth = 200;
        }
    }
}

VB:

Private Sub MyDockSite_AfterDocked(ByVal sender As Object, ByVal e As DockRoutedEventArgs)
    If TypeOf e.DockControl Is DockWindowGroup Then
        Dim dg As DockWindowGroup = TryCast(e.DockControl, DockWindowGroup)
        If dg.IsFloating Then
            Dim w As Window = Window.GetWindow(dg)
            w.MinHeight = 200
            w.MinWidth = 200
        End If
    End If
End Sub

Related posts:

  1. Key Wpf-Dock DockWindow Properties, Events and Commands
  2. How To Start Using Wpf-Dock Control
  3. How to Access and Change WPF-Ribbon Window Title Text Alignment
  4. How to Create WPF Docking Windows Using Code Only
  5. Docking Control support for Windows Forms or other windowed controls in DotNetBar for WPF