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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T22:38:21+00:00 2026-05-20T22:38:21+00:00

I have a tabbed application where I want the user to be able to

  • 0

I have a tabbed application where I want the user to be able to search for a person and then, in a new view, show the person’s details. The user should be able to have multiple person detail views open for different people.

I was a little unsure if I am following the correct procedure for creating my new view. Using Unity (which I am not) it seems you would call Container.Resolve(view) however I am doing the following, the satisfyImports was necessary in order for my imports in the view / viewmodel to be created.

PersonDetailView view = new PersonDetailView();
_container.SatisfyImportsOnce(view);
_regionManager.Regions["MainRegion"].Add(view, this.SelectedPerson.Name);
_regionManager.RequestNavigate("MainRegion", new Uri("PersonDetailView", UriKind.Relative));

In the code for my PersonDetailView I have the following property to set the data context.

[Import]
public PersonDetailsViewModel ViewModel
{
   set
   {
       this.DataContext = value;
   }
} 

This seems to work but the trouble I am having is that when I create a second person view, the new view is getting the same instance of the datacontext as the view that is already created.

Is this because I am creating my views incorrectly or is there a way that I tell MEF to create a new oject when it fulfills the imports for my new view?

  • 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-20T22:38:22+00:00Added an answer on May 20, 2026 at 10:38 pm

    When you export a part, by default it used a CreationPolicy of Shared. This essentially makes the exported instance a singleton in the container. With your export, add another attribute:

    [Export, PartCreationPolicy(CreationPolicy.NonShared)]
    public class Foo { }
    

    This will ensure a new instance is created each time you call to compose the consumer instance.

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

Sidebar

Related Questions

I have a storyboard setup as a Tabbed Application with first view controller containing
i have a tabbed application with 4 navControllers, which all should use the SAME
I've tabbed application with storyboard . I want to have adwhirl below my tabbar.
I have a tabbed layout in my application, and want the settings part to
I have in my application tabbed activities. Now I want from one of those
I have a tabbed application with navigation controllers in tabs and view controller in
I have a tabbed application with navigation controllers in tabs and view controller in
I have the following problem. I have a tabbed application implemented using a ViewPager.
I have an iOS 5 Tabbed Application, using Storyboards. My Tabbar Controller points to
Possible Duplicate: Xcode: Storyboard Tabbed Application Passing Data Back and Forth Basically I have

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.