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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T02:23:10+00:00 2026-05-23T02:23:10+00:00

I’m writing an application where I’m attempting to use an MVVM style architecture to

  • 0

I’m writing an application where I’m attempting to use an MVVM style architecture to handle my data binding (although I’m not using a MVVM specific library, such as MVVM Light). I’ve got a class which stores all of the information that my application requires, and then each of the screens is assigned a view model to its DataContext, which simply selects the values required for the specific screen, formatting the data if necessary.

As an example, the main data store looks something like this:

class DataStore {
    int a, b, c;
    string d;
    DateTime e;
}

And then the view model allocated to a specific screen, which only uses several of the properties, is something like

class MainScreenViewModel {
    public int data1 { get { return App.DataStore.a * App.DataStore.c } }
    public int data2 { get { return App.DataStore.e.Day } }
}

This seems to work fine, when the page loads the data bindings are populated as they should be. However, they do not update automatically when the page loads. I’ve implemented INotifyPropertyChanged on the DataStore, but it seems that the change event doesn’t bubble through to be reflected in the view model. I’m sure I’m going about this a really bad way, so if anyone could help point me in the right direction I’d be very grateful. I’ve read a stack of guides online, but I seem to be confusing myself more and more!

  • 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-23T02:23:11+00:00Added an answer on May 23, 2026 at 2:23 am

    You have to implement INotifyPropertyChanged and raise PropertyChanged on your VM. In order to do this you will have to listen for DataStore.PropertyChanged. Sample:

    class MainScreenViewModel {
        public int data1 { get { return App.DataStore.a * App.DataStore.c } }
        public int data2 { get { return App.DataStore.e.Day } }
    
    
        public MainScreenViewModel()
        {
             App.DataStore.PropertyChanged += (sender, e) => 
                     {
                         if (e.PropertyName == "a" || e.PropertyName == "c")
                             RaisePropertyChanged("data1");
                         if (e.PropertyName == "e")
                             RaisePropertyChanged("data2");
                     };
        }
    
        private void RaisePropertyChanged(string propertyName)
        {
            // raise it
        }
    }
    

    The only part not covered here is the scenario when e.Day will change in DataStore.

    Your approach itself is not the bad and is definitely good enough to start with.

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

Sidebar

Related Questions

I am using Paperclip to handle profile photo uploads in my app. They upload
I am using jsonparser to parse data and images obtained from json response. When
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I am trying to understand how to use SyndicationItem to display feed which is
I am using the SimpleRSS gem to parse a WordPress RSS feed. The only
I want use html5's new tag to play a wav file (currently only supported
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build

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.