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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T23:02:59+00:00 2026-05-24T23:02:59+00:00

I am a beginner to use MVVM in WPF and found that it seem

  • 0

I am a beginner to use MVVM in WPF and found that it seem impossible to change the value of a textbox or a label. Here is an example.

In Xaml:

The original value of Name is “Peter”.

But after I press a button which invoke a command in the ViewModel and change the value of Name to be
“John”. So, suppose the value of the text box will be changed to John as well. However, it doesn’t change.

I have found a lot of example in the net and found that none of them implemented this kind of functions. What I have learnt from them is to use Command and ItemsSource of ListView.
The value of ListView will change when I use button to raise command to change the ItemsSource of the view. Its value will change automatically when the Binding to ItemsSource changed.

However, I cannot make the value of TextBox or Label change even the value of the bindings to them are changed already.

Actually, I am really quite young in MVVM. I think I still have so much that I don’t know.
Could you give me an example of how exactly I should do to make change to textbox after a button click? By the way, I am not quite sure how to make command for button. It seem to involve so much codes that I found in the sample from the net. Is there any simplier way?

Thank you very much.

  • 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-24T23:03:01+00:00Added an answer on May 24, 2026 at 11:03 pm

    Your ViewModel needs to implement INotifyPropertyChanged .
    Documentation see here

    public class Bar : INotifyPropertyChanged
    {
      public event PropertyChangedEventHandler PropertyChanged;
      private string foo;
      public string Foo 
      {
        get { return this.foo; }
        set 
        { 
          if(value==this.foo) 
            return;
          this.foo = value;
          this.OnPropertyChanged("Foo");
        }
      }
      private void OnPropertyChanged(string propertyName)
      {
        if(this.PropertyChanged!=null)
          this.PropertyChanged(this,new PropertyChangedEventArgs(propertyName));
      }  
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Beginner question here. I'm going to make a Jquery function that is used to
im a beginner in using solr. i know that you can either use ajax
I'm looking for code of full applications that (1) use the MVVM pattern and
beginner here... what am i missing? i define a global variable that is a
Rails beginner here. I want to use a few plugins (such as videoJS or
I hear'd that exist binary communication. I'm beginner in java, I use plain text
What database should a beginner use in the C language? Can I use MySQL?
The very common beginner mistake is when you try to use a class property
What are some suggestions for easy to use C++ compilers for a beginner? Free
I am a beginner in design patterns. I am trying to use Abstract Factory

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.