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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T04:58:00+00:00 2026-06-12T04:58:00+00:00

I’m a total newbie, just learning the basics of DataContext and the MVVM model.

  • 0

I’m a total newbie, just learning the basics of DataContext and the MVVM model. I’ve now got a grid bound to a view model object which implements INotifyPropertyChanged, however it appears that UpdateSourceTrigger (which all the WPF tutorials tell me to use) is not available for WinRT / Metro Style apps!

How do I implement INotifyPropertyChanged then?

I’m at the end of my tether here. I’ve spend nearly the whole day on the most basic of app examples, simply trying to get a grid to update after I click something. The only way I’ve managed to do this so far is to create an entirely new instance of the view model and reassign the DataContext which I know is wrong

UPDATE:

I have made some progress, but things have gotten very weird. I have a view model, with a generic list of items. The items list is wired up with a PropertyChangedEventHandler. If I replace the entire collection with a new one, the listview updates.

model.Items = new List<DataItem>{ new DataItem{ Title = "new item" }};

This results in a one item list with the above item. However, if I try adding an item, nothing happens

model.Items.Add(new DataItem{ Title = "added item" });

I also tried creating a method which added an item and specifically fired PropertyChanged, but that also doesn’t work

Here’s where it gets weird. Next I tried this code.

model.Items.Add(new DataItem { Title = "added item" });
model.Items = new List<DataItem> { new DataItem { Title = "new item" }}; 

This results in a two item list:

- new item
- added item

How can this be? The code says, “add one item” then “replace the whole list” but it executes in the reverse order?

UPDATE 2:

I’ve switched to ObservableCollection as suggested, which has actually solved the original problem. I can now add an item and it shows up on the list.

However, the new weird behaviour is still in effect. Items added before the collection is reset are appended to the end of the new collection. Why is my code executing in reverse order?

  • 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-12T04:58:01+00:00Added an answer on June 12, 2026 at 4:58 am

    You need to implement the interface and send out the notification once the given property you care about changes.

            public event PropertyChangedEventHandler PropertyChanged;
    
            public string CustomerName
            {
                get
                {
                    return this.customerNameValue;
                }
    
                set
                {
                    if (value != this.customerNameValue)
                    {
                        this.customerNameValue = value;
                        if (PropertyChanged != null)
                        {
                            PropertyChanged(this, new PropertyChangedEventArgs("CustomerName"));
                        }
                    }
                }
            }
    

    Keep in mind that for a collection, you should use an ObservableCollection as it will take care of the INotifyCollectionChanged being fired when an item is added or removed.

    I would suggest to scale your sample back as far as possible. Don’t start with a DataGrid but rather a simple TextBoxand Button, where the Button forces a change in your ViewModel which will then reflect on the UI.

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

Sidebar

Related Questions

i got an object with contents of html markup in it, for example: string
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
this is what i have right now Drawing an RSS feed into the php,
I've got a string that has curly quotes in it. I'd like to replace
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I have an MVC Razor view @{ ViewBag.Title = Index; var c = (char)146;
I have a view passing on information from a database: def serve_article(request, id): served_article

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.