is RegionManagerServiceScope in XAML in the view needed?

Apr 22, 2008 at 9:30 PM
I was taking a look at Drop 4 and experimenting with the UIComposition project when I ran across the code in the shell's xaml file containing the <prism:RegionManager.RegionManagerServiceScope> tag.

It looks like it is there to set an attached property to a new instance of a RegionManagerService, is this correct?

If so, can't it be moved out to the XAML and put into the view's constructor like so:

this.SetValue(Prism.RegionManager.RegionManagerServiceScopeProperty, new Prism.Services.RegionManagerService());

I did that and removed the XAML and it seems to work fine.

The reason I wanted to remove the XAML is because it ruins the design time experience in Visual Studio 2008 and Blend too I would assume.

Also, other views in the project have the same XAML. Would it be ok to create new RegionManagerServices for them too, or is there a better way?

Apr 23, 2008 at 2:19 AM
See my post

Apr 23, 2008 at 11:36 AM
That certainly works, but what if you replace the implementation of RegionManagerService with another implementation, you won't be able to do that without using the interface, correct?
Apr 24, 2008 at 8:49 PM
If you replace Regionmamanger you will need to change the Xaml regardless.. As it explicitly states the type.. However you can inherit from RegionManager and it will still work.

A lot fo my WPF code uses no code behind , which results in a much eaiser to maintain UI , i have been surprised at this.

Kind of crossing my fingers on the one , the good thing is you are only likley to have one Region Manager in a project .


Apr 28, 2008 at 12:47 AM
Well nevermind anyway, looks like the UIcomposition project is based on a old version of Prism and the RegionManagerServiceScope isn't even in it anymore.
Apr 28, 2008 at 5:11 AM
I hope not - no code behind is a very nice feature

From the readme
New UI Composition QuickStart. Demonstrates shell, global, local regions, and views. Note: This Quickstart uses a branch of the Prism framework source. We will be merging into the main.

SO it will be there.


Apr 28, 2008 at 4:26 PM
hmm, guess I read the readme incorrectly.

Hopefully having that included doesn't break the design time experience.
May 1, 2008 at 3:47 PM
Edited May 1, 2008 at 3:50 PM
Sorry, spoke a bit too soon :(