Hello, I have a small problem with Regions in PRISM. All basics tests work fine, but now I want to replace the following XAML with pure C#:
<UserControl x:Class="CAL.Modules.Simple.Region_Testing.RegionManagerTypes.XAML.ItemsControlRegionAdapterTest"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:cal="clr-namespace:Microsoft.Practices.Composite.Presentation.Regions;assembly=Microsoft.Practices.Composite.Presentation"
Height="Auto" Width="Auto">
<ItemsControl cal:RegionManager.RegionName="ItemsControlRegionAdapterTestRegion"/>
</UserControl>
The code inside my testing class is fairly simple, I access the RegionManager and add some test views. However, as you see in the XAML above, there is actual nothing happening in the UserControl except from attaching the RegionManager to the Control. I am sure this must be possible in Code, extending the following lines I already have:
// MISSING
// Creating the UserControl in CODE instead of XAML
// Create the UserControl and add it to the main window
regionManager.AddToRegion(RegionNames.MainRegion, new ItemsControlRegionAdapterTest());
// Add some views to the region inside the user control
var currentTestRegionName = TestingRegionNames.ItemsControlRegionAdapterTestRegion;
regionManager.Regions[currentTestRegionName].Add(new BlueView());
regionManager.Regions[currentTestRegionName].Add(new RedView());
Thanks for any tips...