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

  • Home
  • SEARCH
  • 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 5947947
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T17:02:14+00:00 2026-05-22T17:02:14+00:00

I am using prism view-based navigation with the RequestNavigate method. The problem I encouner

  • 0

I am using prism view-based navigation with the RequestNavigate method.

The problem I encouner is that I have to register all the ViewModels with the container:

container.RegisterType<object, InboxView>("InboxView");

This is very verbose and requires a list of all the view types I want to register.
Is there any workaround for it?

I think the RequestNavigate should have been generic:

IRegion.RequestNavigate<TView>();

And should perform the following:

  1. Resolve the view
  2. Give the view a name in the region that should be typeof(TView).Name
  3. Perform the actual navigation request 🙂
  4. Please vote for my suggestion digest in the Prism issues list.
  • 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-22T17:02:15+00:00Added an answer on May 22, 2026 at 5:02 pm

    I see what you are trying to get at, but the proposed solution doesn’t really meet with design goals of RegionManager. In particular:

    1. Region requests are type agnostic. If you don’t have a reference to a type in Module A from Module B, but want to navigate there, how can can you navigate without these modules referencing each other or having those types refactored into a 3rd assembly?
    2. Regions can have as many views of a particular type as necessary. Your proposed solution would artificially limit the number of views of a particular type to one, which is not currently how regions work.

    This doesn’t answer your question, though.

    As for reducing the verbosity, there isn’t much you can do other than roll your own solution that encapsulates the behavior your want in front of RegionManager. Personally I wouldn’t go this route, but it’s certainly something you could do. You can write this as your own service, or simply an extension method on IRegionManager or IRegion.

    public interface IMyNavigationService
    {
         //Your own implementation could use (typeof(T)).Name (or 
         //AttributedModelServices.GetContractName(typeof(T)) if using MEF)
         //as the Key, if thatis appropriate for your solution 
         //(1 instance T per region and references to T from all Modules)
         void RequestNavigation<T>();
    }
    

    It looks like a switch to MEF as an IoC container might help for your needs… it just depends on which of these lines of code you don’t care for. For me, I don’t like the RegisterType<object, InboxView>. The MEF equivalent would be:

    [Export]
    public class InboxView { .. }
    

    You can provide a contract name here ([Export("InboxView")]), but by default it will provide a contract name of AttributedModelServices.GetContractName(typeof(InboxView)). As long as whatever you choose is consistent with how you chose to generate the name in the implementation of IMyNavigationService, it should work fine.

    Here is the same thing, but with an extension method implementation (with a MEF implementation… you can choose some other key generation method if you use Unity… you’ll just have to add registration of that type in the method as well)

    public static class RegionExtensions
    {
        public static void RequestNavigate<T>(this IRegion region)
        {
            region.RequestNavigate(AttributedModelServices.GetContractName(typeof(T)));
        }
    }
    

    If you are nervous about switching everything to MEF, there is a MefContrib project that makes this much easier… it basically combines Unity and MEF in one.

    Hopefully this helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an application which I am developing using WPF\Prism\MVVM. All is going well
I have a WPF application based on PRISM that utilizes the MVVM pattern. I
I'm using PRISM in a SilverLight 4 application. I have a problem where views
After weeks of using Prism I have been through every kind of navigation methods.
Using WPF and Prism. I have a view, containing 1 textblock <UserControl x:Class=ArmoryModule.Views.ResultsView xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation
I'm using prism to load views to region. The problem is the loaded view
I have a class that is a viewmodel (using Prism). It has an associated
Using Prism - what is the best way to handle navigation in a WPF
How i can declare a global method in delphi prism using the __Global class?
I'm building a menu using Prism (using a trtelerik tree view with hierarchy data

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.