I'm trying to get a simple test app up and running with the following functionality:
A main window with an empty docking container.
A dockable view pane that is created on the fly. (Where multiple panes are created as needed.)
So far I have this for my main window:
And this for my dockable pane:
Where my main window is a <Window> and my view is a <UserControl>.
This gives me an empty window, and I can create views through the main window's main menu. The views are created and docked as follows:
Which gives me almost what I want - the views are created and docked in the main window by default. (The text on the tab is missing, but I can figure that out later.) The problem I am having now is any attempt to undock one of those views by dragging its tab results in a crash with the following callstack:
The output window of Visual Studio has the following (extremely unhelpful) message:
An unhandled exception of type 'System.ArgumentNullException' occurred in PresentationFramework.dll
Additional information: Value cannot be null.
So, I'm wondering what it is I'm missing, or does the WPF docking library not support creating views dynamically? (All the samples and examples I've seen do only seem to build static GUIs where all the components are known at compile time.)