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 8721085
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T07:09:53+00:00 2026-06-13T07:09:53+00:00

I am trying to control when a new view is created and when an

  • 0

I am trying to control when a new view is created and when an existing view is shown.

This is a very similar scenario as outlined in the “Navigating to Existing Views” section in the Prism documentation, but I can’t get it to work fully:
http://msdn.microsoft.com/en-us/library/gg430861(v=pandp.40).aspx

I am finding I can create the view/view model to begin with ok, but I am then unable to create a new instance of it. I.e. I want more than one instance to exist at once.

Here’s an example of the view model:

[Export]
[PartCreationPolicy(CreationPolicy.NonShared)]
public class DataEntryPageViewModel : INavigationAware, IRegionMemberLifetime
{
    private Guid id;

    [ImportingConstructor]
    public DataEntryPageViewModel()
    {
        id = Guid.NewGuid();
    }

    public bool IsNavigationTarget(NavigationContext navigationContext)
    {
        // In actual fact there would be more logic here to determine
        // whether this should be shown to the user
        return false;
    }

    public void OnNavigatedFrom(NavigationContext navigationContext)
    {
    }

    public void OnNavigatedTo(NavigationContext navigationContext)
    {
    }

    public bool KeepAlive
    {
        // For the purposes of this example we don't want the view or the viewModel
        // to be disposed of.
        get { return true; }
    }
}

I am navigating to this as follows:

m_RegionManager.RequestNavigate(
               "MainRegion",
               new Uri("/DataEntryPageView", UriKind.Relative));

So the first time I call the above the view is shown.

The next time I call RequestNavigate the IsNavigationTarget is hit and it returns false. What I then want it to do is to create a new instance but that doesn’t happen. I know it’s not happening because the constructor does not get hit and the UI does not update to show the new instance of the view.

Any ideas how I can make it create a new instance?

Many thanks,

Paul

Edit

I have noticed that the second time I call RequestNavigate (to request another instance of the same view) the callback reports an error “View already exists in region.” It therefore seems that I can have multiple instances of different views in a region, but not multiple instances of the same view. My understand of this isn’t great though so I could be wrong.

  • 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-06-13T07:09:54+00:00Added an answer on June 13, 2026 at 7:09 am

    I have now been able to get this to work, it was because I didn’t have

    [PartCreationPolicy(CreationPolicy.NonShared)]
    

    on the class declaration of the view. I had it on the ViewModel.

    So this is now resulting in the behaviour I expected.

    Thanks though to Zabavsky and Alan for your suggestions.

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

Sidebar

Related Questions

I don't know alot about ASP.Net but I'm trying to make a new control
I'm trying to make a new wx.Choice-like control (actually a replacement for wx.Choice) which
I am trying to control tabs with a next/previous options. This is my JSFIDDLE
I this: http://jsfiddle.net/ZP76c/ I'm trying to control the scope at which jQuery selects elements
I'm very new to Django, having never developed on it. I'm trying to develop
I'm new to ASP.NET MVC and I'm trying to create a very simple blog
I am trying to create a extension from an existing view where I have
I am trying to add a new view to a working nav controller app.
I'm trying to create a list of videos that a user may view. This
I am trying to create a datapager usercontrol. This user control has one event

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.