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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T22:34:50+00:00 2026-05-17T22:34:50+00:00

I am little confused about how to create Master Detail view with two different

  • 0

I am little confused about how to create Master Detail view with two different user controls.

There are three choices,

Choice 1

CustomerMasterView + CustomerMasterViewModel
CustomerDetailView + CustomerDetailViewModel

And keep both View Models in App.Resources

But by doing this, binding becomes complex with all static resources source markup code.

Choice 2

CustomerViewModel
CustomerMasterView
CustomerDetailView

Both views share same ViewModel via App.Resources, well even with the binding code has too many items.

Choice 3

CustomerMasterView + CustomerMasterViewModel
CustomerDetailView + CustomerDetailViewModel

Both view’s have DataContext set to their corresponding ViewModel. Now here is the little issue,
CustomerMasterView has Selector (ListBox or DataGrid or whatever), whose SelectedItem needs to be bound to CustomerDetailViewModel’s “Customer” Property as two way binding.

Does it look good?

<!-- CustomerMasterView -->

<ListBox
    ItemsSource="{Binding CustomerList}"
    SelectedItem="{Binding DataContext.Customer,ElementName=customerDetailView}"
    />

<local:CustomerDetailView
    x:Name="customerDetailView"
    />

But by doing this, I am defying purpose of ViewModel as it adds more dependency in my UI code.

Which one is most preferred way or is there any other way?
Should I create nested View Models?

I am also trying to learn Prism, and I have little confusion of how to do this right, any help will be appriciated.

  • 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-17T22:34:51+00:00Added an answer on May 17, 2026 at 10:34 pm

    The simplest appraoch in my opinion would be to have a single view model, with two UserControls.

    Your ViewModel would have your list of customers, as well as a “ActiveCustomer” or “SelectedCustomer”. Your MasterView (with the DataContext set to you ViewModel), would contain your list, wired up like this:

    <ListBox ItemsSource="{Binding Customers}" SelectedItem="{Binding ActiveItem, Mode=TwoWay}" />

    Your MasterView will also include your DetailsView (another UserControl). It looks like this:

    <views:DetailsUserControl DataContext="{Binding ActiveItem}" />

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

Sidebar

Related Questions

I'm a little confused about all the different ways to create a new jQuery
I am a little bit confused about 2 things. Firstly when I create an
I'm a little confused about JBOSS and running it under different JDKs. For example,
I am a little confused about where to get (or create) a distribution profile
I'm looking to create a web.config file and I'm a little confused about which
I'm a little confused about how the standard library will behave now that Python
I'm a little confused about HTML classes and IDs, as I'd like to use
I am a little confused about how I set and get the instance variables
I'm a little confused about what is going on in Perl constructors. I found
I am a little confused about object assignment and pointers in Ruby, and coded

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.