Build and run the Itp.WpfAppBar.UndockSample app.
Click "Switch DockMode". The app docks, as expected.
Click "Switch DockMode". The app un-docks, as expected.
Click "Switch DockMode". A copy of the main window is shown instead of docking the current window.
The bug seems to be in the interaction of the DockMode property getter and ShowDockMode() in DockableWindowControl.cs. The getter checks for AppBarHost == null but when we leave the dock mode, this code runs:
if (AppBarHost != null)
{
AppBarHost.Content = null;
AppBarHost.Close();
}
This does not set AppBarHost to null so after this point, the DockMode will return Docked even though we've closed the appbar.
Build and run the Itp.WpfAppBar.UndockSample app. Click "Switch DockMode". The app docks, as expected. Click "Switch DockMode". The app un-docks, as expected. Click "Switch DockMode". A copy of the main window is shown instead of docking the current window.
The bug seems to be in the interaction of the
DockMode
property getter andShowDockMode()
in DockableWindowControl.cs. The getter checks forAppBarHost == null
but when we leave the dock mode, this code runs:This does not set
AppBarHost
tonull
so after this point, theDockMode
will returnDocked
even though we've closed the appbar.I think this is the proper fix:
A similar change is needed just below that for
WindowHost
: