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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:27:06+00:00 2026-05-26T13:27:06+00:00

I am having a problem with the textbox text updating in my view. I

  • 0

I am having a problem with the textbox text updating in my view. I have seen some other threads but cannot find one that is close to my setup.

I have a model with a class of

    interface IPerson : INotifyPropertyChanged
    {
       string FirstName { get; set;}    
    }

    public class Person
    {
      public event PropertyChangedEventHandler PropertyChanged = delegate { };
      private string _firstName;
      public string FirstName
      { 
           get {return _firstName;}
           set 
           {
             _firstName = value;
             PropertyChanged(this , new PropertChangedEventArgs("FirstName"));
           }
       }
     }

This is what my viewModel Looks Like

    interface IViewModel : INotifyPropertyChanged
    {
      string FirstName { get; set;}
      IPerson Person { get; set; }
    }
    public class viewModel : IViewModel
    {
      public event PropertyChangedEventHandler PropertyChanged = delegate { };
      private IPerson _person;
      public Person Person
      { 
        get {return _person;}
        set 
            {
               _person = value;
                PropertyChanged(this , new PropertyChangedEventArgs("Person"));
            }
       }          
       public string FirstName
       {
          get {return Person.FirstName;}
          Set 
          {
              Person.FirstName = value;
              PropertyChanged(this , new PropertChangedEventArgs("FirstName"));
           }

        }
    }

Xaml Binding Setup

// If i use this binding my model will get updated but my textbox text will never show what the value is in the model
Text="{Binding Path=FirstName ,UpdateSourceTrigger=PropertyChanged,Mode=TwoWay,diag:PresentationTraceSources.TraceLevel=High}"

// This binding works fine both ways
Text="{Binding Path=Person.FirstName ,UpdateSourceTrigger=PropertyChanged,Mode=TwoWay,diag:PresentationTraceSources.TraceLevel=High}"

So if i bind to the Person.First Name everything works great. If I bind to FirstName then it will update my model fine but will not get the data for The TextBox Text. This becomes apparent when i select an item in my list.

Does anyone have an idea why this would happen. I want to be able to bind to the ViewModel Firstname and just have it pass that to my person object.

  • 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-26T13:27:07+00:00Added an answer on May 26, 2026 at 1:27 pm

    If your model changes the FirsName value it triggers an PropertyChanged event but that is not extended (relayed) by the ViewModel.

    To make the first binding work your ViewModel should subscribe to Person.PropertyChanged and then raise its own event when the nested FirstName changes.

    But of course the Path=Person.FirstName binding is preferable anyway.

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

Sidebar

Related Questions

We are having problem with the server migration. We have one application that are
I'm having problem automating to type the text in the textbox with variable id's
Morning - I'm having a little problem. I have an autocomplete extender textbox where
I'm having the following problem: I have a page where a user inserts text
I'm having a problem displaying data from a function to text box within a
I'm having problem when running my Windows Forms program. In the program, I have
I am having problem in getting reference of Ajax control extender using $find() or
I'm having a pretty nasty problem with an auto-completing textbox. I want to initiate
Having a slight problem on C#, still quite new to the language but hoping
I am having a performance problem binding a large string to a a TextBox

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.