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

The Archive Base Latest Questions

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

I am using a mvvm pattern for an application that sources its data from

  • 0

I am using a mvvm pattern for an application that sources its data from a sql ce database using the Entity Framework version 4. The WPF application only has one view (don’t need anymore as the app is not that big). I am displaying a collection of properties from the database in a listbox, by creating an observablecollection in my viewmodel and binding this. This works exactly as expected. The issue is that I now have another listbox (in the same view) that needs to be populated with Images for each property. To be clear, each property has a bunch of images, but each image is only assigned to one property.

What would be the best way to display the images, I thought maybe creating another observablecollection for the images, but I am not sure how I would then ensure that only images for the appropriate property are shown. Or should I simply bind the listbox to the Images property of each property (house)?

Cheers

    private void Load()
    {
        PropertyList = new ObservableCollection<Property>((from property in entities.Properties.Include("Images")
                                                          select property));
        propertyView = CollectionViewSource.GetDefaultView(PropertyList);
        if (propertyView != null)
            propertyView.CurrentChanged += new System.EventHandler(propertyView_CurrentChanged);           

        RaisePropertyChanged("CurrentContact");
        RaisePropertyChanged("SaleTitle");
        RaisePropertyChanged("Address");
        RaisePropertyChanged("AuctioneerName");
        RaisePropertyChanged("AgentName");
        RaisePropertyChanged("Price");
        RaisePropertyChanged("NextBid");
        RaisePropertyChanged("Status");
    } 
  • 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-02T03:37:42+00:00Added an answer on June 2, 2026 at 3:37 am

    That sounds distinctly like a different responsibility (a master/details view). In the true spirit of MVVM I’d create a new View and a new ViewModel – perhaps:

    PropertyImagesViewModel
        - public Property Property { get; set; }
        - public IList<Image> Images { get; set; }
        - public int SelectedIndex { get; set; }
    
    PropertyImagesView
    

    Don’t forgot to call RaisePropertyChanged() in each of the property setters

    Also note that ObservableCollection does nothing if you aren’t manipulating the contents one-at-a-time. If all do you is update the entire collection all-at-once, then it gives you no tangible benefit.

    Another thing – if you need to notify that all your properties changed:

    RaisePropertyChanged(null);
    

    will do the trick.

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

Sidebar

Related Questions

I'm creating a WPF application using the MVVM design pattern that consists of a
I am developing an application that uses Entity Framework and WPF with MVVM design
I'm using Entity Framework 4 and WPF with the MVVM pattern. Now I'm facing
I am writing an application using the MVVM pattern. I am providing data to
My WPF application is structured using the MVVM pattern. The ViewModels will communicate asynchronously
I'm working on a WPF application, and I'm structuring it using the MVVM pattern.
Using the MVVM pattern creating WPF applications you have the ViewModel providing data to
I have a WPF app that is using the MVVM pattern. Hooking up buttons
I’m building a WPF application using MVVM pattern (both are new technologies for me).
I have a WPF Microsoft Surface Application and I'm using MVVM-Pattern. I have some

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.