
Hello,
I'm trying to use Prism to make the UI in my application composable and more maintainable. In my Shell.xaml (top level view), I define the DockSite and add some ToolWindowContainers that define the various regions. One of those is a region where I want to add additional dockable items defined in other modules. I do that like this:
<!-- Model -->
<docking:ToolWindowContainer docking:DockSite.ControlSize="400,400">
<docking:ToolWindow x:Name="deviceToolWindow"
Title="Device"
prism:RegionManager.RegionName="{x:Static m:RegionNames.DeviceRegion}" />
</docking:ToolWindowContainer>
In the region, I would like to include additional tool windows that are dockable in the main docksite. So, for example, the DeviceView.xaml is hooked up in Prism so it is the view that is loaded into the DeviceRegion. It is a UserControl with the following in it (minus all other namespace declarations, etc):
<docking:ToolWindowContainer docking:DockSite.ControlSize="400,400">
<docking:ToolWindow x:Name="outputGroupWindow"
Title="Output"
prism:RegionManager.RegionName="{x:Static m:RegionNames.OutputsGroupRegion}" />
</docking:ToolWindowContainer>
What I actually want in the DeviceView is to be able to just define a ToolWindow, but that does not work correctly. I wasn't able to define a ToolWindowContainer as a Prism region. So I had to define a new ToolWindowContainer. I'd like to be able to just define a ToolWindow in the DeviceView.xaml code and it would use the ToolWindowContainer in the parent Shell class. I wasn't able to get that to work. If I define just the ToolWindow, nothing actually gets loaded into the region. Is there a way to make that work?
To work around that issue, I created teh ToolWindowContainer in the DeviceView.xaml. However, when the application is run, if the DeviceRegion is dragged around into any of the other dockable areas, an exception occurs. I assume this is because the toolwindow is not correctly registered with the DockSite properly. I get an InvalidOperationException "Attempt to remove from unknown parent class...".
So I essentially have two questions:
1) What is the proper way of defining a ToolWindow in a custom UserControl so it will correctly locate the ToolWindowContainer up in the hierarchy?
2) What is the proper way of defining a ToolWindowContainer in a custom UserControl so it will bind to the DockSite appropriately to allow docking?