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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T06:34:38+00:00 2026-05-24T06:34:38+00:00

new to WPF and MVVM, and trying to get my head around the normal

  • 0

new to WPF and MVVM, and trying to get my head around the normal way to do things.

Say I have an observable collection of customer objects. I can bind a ListView, or ItemsControl to this and they all display fine.

Now say I have some supplementary information about each item that is not stored in the customer object. Say perhaps a special offer is on, and certain customers are eligible for the offer, but this flag is not held in the customer object.

What is the standard way to display this supplementary info in the list?

My immediate thought is to create a new collection of some structure in my viewmodel that contains both a customer object, and this flag. I can then bind the list straight to this collection, and bind the various display components to the appropriate struct members.

However, this seems a bit of a waste when I already have an ObservableCollection of customers. If I want the new list to be “live”, then I need the new collection to subscribe and react to add/removes in the underlying customer collection.

Is this the way to do it? Or is there some way I can maintain the offer flags in some way separately, and yet still bind to them in my ListView?

Many thanks

  • 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-24T06:34:39+00:00Added an answer on May 24, 2026 at 6:34 am

    When using the MVVM pattern, the ViewModel is the “model of your view”, i.e. it is a model that closely resembles your current view.

    I can see why you might want you underlying model to store offers and customers separately.

    Pseudocode:

    class MyModel
    {
       List<Offer> Offers {get; set;}
       List<Customer> Customers {get; set;}
    }
    

    However, you cannot bind a ListView to your customers and somehow correlate them with your offers. It is the role of your ViewModel to shape the Model so that it is easier to bind it to your view:

    class CustomerViewModel
    {
        // the customer model
        private Customer customer;
    
        // and offer - might be null
        private Offer offer;
    
        // expose properties of the two above model objects here
    } 
    

    Your view model would create an ObservableCollection of these CustomerViewModel instances, using the collection of model Customer instances, locating an Offer if one exists.

    This ObservableCollection<CustomerViewModel> can be readily bound to your view.

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

Sidebar

Related Questions

I have a wpf-mvvm application. I have an observable collection in my viewmodel public
I'm new to WPF and MVVM. I'm struggling to determine the best way to
I am trying to implement MVVM in a new project (based on WPF &
I have recently started learning wpf and am trying to use mvvm. My understanding
Being a new to WPF/XAML/MVVM, I've got a question. In my View, I have
I'm pretty new to WPF and implementing it via MVVM, and I'm trying to
I'm trying to structure my WPF MVVM application according to best practises. I have
I'm new to WPF and using MVVM. I have a view in which I
I am new to WPF and MVVM, and I am working on an application
Being new to both WPF and MVVM, I'm studying Josh Smith's article on the

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.