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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T17:29:51+00:00 2026-05-13T17:29:51+00:00

its said that 1 ViewModel has 1 View. 1 View is for me a

  • 0

its said that 1 ViewModel has 1 View.

1 View is for me a UserControl. What if my UserControl has different areas filled with data from different entities, do I have then several Views and need to build several ViewModels?

e.g: I display in a UserControl 3 entities: customer(listbox),order(datagrid),product(datagrid). Each of those “data areas” has add+remove buttons and textboxes to enter data.

Actually each of those “data areas” are put in its own GRID having so the posibility to set a individual datacontext.

1.) Should I now create 3 ViewModels CustomerVM,OrderVM and ProductVM?
2.) Are those 3 “data areas” seen as an own sort of separated View, although I have not put them in 3 UserControls.xaml files ???
3.) When this one UserControl is inside a TabControl`s tabpage where do I load the 3 entities related data? Inside the MainViewModel? I want to show/load that data only when the user clicks the tabheader.

  • 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-13T17:29:51+00:00Added an answer on May 13, 2026 at 5:29 pm

    No, you can do all that in the one viewmodel. The job of the viewmodel is to hold the data for the view, and if necessary transform that data so the view can consume it. There is nothing that says a viewmodel has to hold specific types of information, i.e. there are no rules that state “it may only hold customer info and not order info”.

    Having said that, there is also no reason why the viewmodel cannot be consumed by several different views (give them all different instances, of course) – this would show that you have a good separation of concerns between your views and viewmodel. Personally, i code my viewmodels so that they have no idea that the view exists. There is also no reason why the view has to consume everything that the viewmodel exposes, although binding a CustomerView to a CustomerOrderProductViewModel is going a little too far.

    Edit: let me explain that last paragraph a little more.

    Example 1: i have a new V which shows customer information, and i have an existing VM which has customer info AND order info

    I would be reluctant to use this VM for this V, because while it does have the client info i need, it has too much info – i’m using the VM out of the context is was originally intended for.

    Example 2: i have a VM that contains full client info, like their postal and residential address, their phone numbers, their girlfriend's names*, and a bunch of other client type info. I have a V which shows the client's name, birthday, and maybe two other properties.

    I would consider using that VM for that V, this illustrates my point that the V doesn’t have to show all the info contained within the VM. This concept becomes more apparent when you change the V (as in, do some maintenance and change the UI of the view, because someone has decided that they want a bunch of fields removed and now they want to represent the client’s age as an image) – i can still use the same VM, and just change the V (i could use a ValueConverter to represent the age as an image, thus avoiding a change to the VM).

    At what point would i stop using the current ClientViewModel, and write a new one that was more specific to the needs of the modified ClientView?

    There is no clear cut answer to that – it depends on the amount of time i have available to do the changes, the amount of time available for testing, and the trade-off in complexity between using a full blown Client object for the VM, and writing a new leaner version of the Client object while still retaining the old one.

    *that should be a collection of independant objects incorporated in the client object, but just work with me here it’s a made up example 🙂

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

Sidebar

Related Questions

Its said that property should not be Set only (Code analysis rule CA1044 )and
Somebody said that when your PHP code and application use global variables then it
I have a WPF app with a textblock that displays the current time. Said
Its always said that the requirements should be traceable but when we talk about
I've heard it said that the Entity Framework is overkill or that it's difficult
its out of question that a dao will not hold any state. however, for
MSDN said that BlockingCollection.Take call blocks if there is no elements in it. Does
It is said that fork system call creates a clone of the calling process,
One of the answers to this SO question said that MSN OpenID was in
Is there a best practice in getting data from multiple database tables using Zend?

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.