Adding view to a ToolWindow using the RegionManager

Sep 14, 2012 at 2:48 PM

I'm struggling to add a view to a ToolWindow with the prism RegionManager.

Several ToolWindows are created runtime, and the RegionManager is set in code to update the visual tree.

RegionManager.SetRegionManager(viewThatOwnsTheContentControl, regionManager);

However, when trying to add:

regions["SomeRegion"].Add(view, viewName)

And this region is a ContentControl, within a ToolWindow:

 <ContentControl prism:RegionManager.RegionName="{x:Static Framework:RegionNames.SomeRegion}" />

It is added, but never displayed.

If I try the same code, but with a region loaded in Shell.xaml, it works fine. Also tried with a TabControl, to see if there was any problems related to it, but it worked fine as well.

Any clues?

Sep 14, 2012 at 3:53 PM

Solved it, the user control hosting the region was added as a VM and not as a View to the hosting Tool Window.