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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T09:00:37+00:00 2026-06-02T09:00:37+00:00

I have a ViewModel that can create another ViewModel. I want to set this

  • 0

I have a ViewModel that can create another ViewModel.

I want to set this ViewModel as the data context of existing View, then Navigate to that View.

In MyViewModel

private void CreateNewOrder()
{
    var order = new OrderViewModel(new Order(){/* setup some things */});
    // another ViewModel subscribes to MyCustomEvent
    this.eventAggregator.GetEvent<MyCustomEvent>().publish(order); 
    this.regionManager.RequestNavigate("DetailRegion", new Uri("OrderView", UriKind.Relative));
}

The problem is …

  • My ViewModel needs reference to the region’s name, and the View’s name.
  • “DetailRegion” must contain the “OrderView” object.
  • DetailView.DataContext is set to OrderViewModel (using aggregate event subscription)

Is this tight coupling?

I’ve spent sometime looking in the Prism Quickstart project and found the “Controller” or something that is too complicated.

I just want to simplify decoupling View-ViewModel.

  • 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-02T09:00:39+00:00Added an answer on June 2, 2026 at 9:00 am

    The code you have added to the ViewModel, belongs in a controller.

    • ViewModels are dumb containers that hold a certain shape of data. They do not know where the data comes from or where it is displayed.
    • Views display a certain shape of data via bindings to a view model. They do not know where the data comes from, only how to display it.
    • Models hold real data. They do not know where is is consumed.

    So what’s missing from this picture?
    – Controllers publish and listen for events and fetch data for the
    ViewModel from a Model. They also control navigation.

    It really should have been designed as MVCVM. I see no end of misuse of MVVM through the absence of controller classes. Give the Prism Quickstart another go.

    Just to clarify how a controller fits into the MVVM picture, here is an example
    scenario:

    • Controller is registered and initialized by the module or app*.
    • Controller subscribes to a “show details” message.
    • Controller receives a “show details” message.
    • Controller constructs a “details” VM, fills it with data and assigns any ICommand properties to code in the controller (e.g. pretty much all app
      logic is in controllers).
    • Controller triggers display of the appropriate view, supplying the VM.
    • View data is bound to VM. Buttons are bound to ICommands in the VM.
    • User edits data and clicks submit. The submit code is in the Controller and decides what to do with the new data in the VM.

    *Note: VMs and views do not need to hang around waiting for messages, so only controllers actually need to exist for the lifetime of the app (i.e. very small footprint). This is great for mobile apps and generally a good thing for any app.

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

Sidebar

Related Questions

I have a ViewModel (AbstractContextMenu) that represents my context menu (IContextMenu), and I bind
I have a class that roughly looks like this: public class ViewModel { public
I have a view that I pass a viewmodel object to that contains an
I have a Knockout.js view model that looks like this: UserName:null, FirstName:null, LastName:null, Countries:{
I have a viewmodel that contains a product and SelectList of categories. public class
I have a viewmodel that contains a number of properties, a SelectList, and an
I have a ViewModel that contains a Product type and an IEnumerable< Product >
I have a ViewModel class that contains a list of points, and I am
I have a Usercontrol(TabUserControl) which contains a TabControl. The Viewmodel of that UserControl loads
I have the following ViewModel, which is the base class of other ViewModels that

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.