Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 972909
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T03:11:53+00:00 2026-05-16T03:11:53+00:00

To build a composite application view in my application, with different regions, untill now,

  • 0

To build a composite application view in my application, with different regions, untill now, I’ve always used content presenter and used DataBinding to set its content.

If I wanted to change its content, I would just have to use an event aggregator, publish a ViewZoneChangedEvent, subscribe to it in the “shell” window, and update the viewmodel accordingly so that the new data would be available for the binding and the UI be updated.

Now, I recently came across those Regions in Prism, actually I had seen them for a while but I didn’t feel comfortable with them, but since Prism is some kind “best practices guidance” maybe I’m missing something : Let me explain why I feel uncomfortable.

with my old way of doing, there is no coupling with the XAML. you never mention any specific magic string that should be present in the XAML, and I think that’s essential, since the style can change.

If at least the regions would perform a compile-time check of the region names ( check it really exists somewhere ) that would enforce using valid region names and be very helpful when refactoring, but as far as I know, there’s no such thing. Some people use enums and the ToString method of an enum to convert it to a string and use it as a region name, but again, as far as I know, there’s no real routine to check if the string typed really is valid and show an error when compiling the way it is done for Brushes.InValidColor for instance.

So, my question is the following : what do the prism regions bring to the table compared to plain old binding (plus eventAggregator if you wish to communicate across ViewModels) ?

and are my assumptions true about the compile-time verification of the region names ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T03:11:54+00:00Added an answer on May 16, 2026 at 3:11 am

    It’s much cleaner to use regions than to do it “by hand”. Using regions you don’t require any knowledge on how you need to add new views to the composite parent.
    If you do it “by hand” you have to add some code-behind in your view, which is a bad thing.

    The way I avoid magic strings is to define all the region names as constants

    public class RegionNames
    {
        public static string MainRegion { get { return "MainRegion"; } }
    }
    

    and then set the region up as a resource thus (in the App.xaml for instance)

    <Application.Resources>
        <ResourceDictionary>
            <infrastructure:RegionNames
                xmlns:infrastructure="clr-namespace:MyClass.Silverlight;assembly=MyModule.Silverlight"
                x:Key="RegionNames" />
        </ResourceDictionary>
    </Application.Resources>
    

    I then add module-specific region names as constants at the module level.

    There’s unfortunately no compile-time check but it’s much better and cleaner than adding the region names directly in the XAML, especially if you reuse the name in code later on.

    EDIT: I forgot to include the XAML to show how you use this constant. This is now corrected.

    Somewhere at the top of the XAML, include the reference to the region manager:

    xmlns:Regions="clr-namespace:Microsoft.Practices.Composite.Presentation.Regions;assembly=Microsoft.Practices.Composite.Presentation"
    

    And then when setting up the region use the region name defined as the resource

     <ItemsControl Regions:RegionManager.RegionName="{Binding MainRegion, Source={StaticResource RegionNames}}" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to build a 32-bit float out of its 4 composite bytes. Is
Suppose a large composite application built on several foundation components packaged in their own
I build and maintain a set of Flash components that is distributed to publishers
In a Composite Application (Prism), when my module loads , I get this error:
I'm using the Composite Application Guidelines (Version 2, Feb 2009). I've built the Shell
I recently looked into Prism (aka the Composite Application Library for WPF) and really
I have been asked to build a POS Application for a Restaurant. I have
In my application I have an entity which is being used essentially as a
I'm trying to create a composite ASP.NET control that let's you build an editable
I inherited a database built with the idea that composite keys are much more

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.