
I am looking to load a ToolWindow defined in an XAML resource file. Here is what it looks like:
Here is how I load the XAML file:
Loading the control is fine, the issue arises when I attempt to Dock the window to my DockSite. Calling Dock and then Open throws an exception:
This operation is invalid since the DockingWindow has not yet been registered with a DockSite.
If I do some fancy footwork prior to calling Dock and Open, I can get it to load properly:My question is, how do I do this cleanly?!
<docking:ToolWindow
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:docking="http://schemas.actiprosoftware.com/winfx/xaml/docking"
Title="MyWindow">
<TextBox Text="This Window displayed correctly." />
</docking:ToolWindow>
var myWindow = ( ToolWindow )Application.LoadComponent( new Uri( "MyWindow.xaml", UriKind.Relative ) );
This operation is invalid since the DockingWindow has not yet been registered with a DockSite.
If I do some fancy footwork prior to calling Dock and Open, I can get it to load properly:
var temp = RootDockSite.Content;
RootDockSite.Content = myWindow;
RootDockSite.Content = temp;