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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:41:41+00:00 2026-05-27T06:41:41+00:00

I have trouble getting a binding done using the WPF. I have a model

  • 0

I have trouble getting a binding done using the WPF.

I have a model class which is similar to this:

public class DataModel 
{
     private double _temp;

     public double Temperature 
     {
        set
        {
            _temp= value;
            OnPropertyChanged("Temperature");
        }

        get { return this._temp; }
     }
 }

This model is derived from a class BaseDataModel

public abstract class BaseDataModel
{
    public event PropertyChangedEventHandler PropertyChanged;

    protected void OnPropertyChanged(string propertyName)
    {
        PropertyChangedEventHandler handler = this.PropertyChanged;
        if (handler != null)
        {
            var e = new PropertyChangedEventArgs(propertyName);
            handler(this, e);

        }
     }
 }

I now have a list of DataModel objects in another class called DataViewModel, the List is named “Values”. In a class above that class I have an UserControl that needs to de dynamically created at runtime, therefore binding is done in code behind like this :

somewhere above the list:

DataViewModel model = new DataViewModel();

and the binding itself:

curbinding = new Binding();
curbinding.Source = model.Values;
curbinding.Path = new PropertyPath("Temperature");
curbinding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;
myTextBox.SetBinding(TextBox.TextProperty, curbinding); 

I know that PropertyChanged is fired, but the value of the text box is not updated. I just can’t figure out why? When I create the bindig the first time, the text of the text box is updated, but when I change the value of Temperature, nothing happens.
Did I not think of something?

I have to say, that the application has a lot of other classes and is more complex, but as I said, the value is updated once, and never again.

  • 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-27T06:41:42+00:00Added an answer on May 27, 2026 at 6:41 am

    If you didn’t read the comments I simply forgot to implement INotifyPropertyChanged …

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

Sidebar

Related Questions

iI have some trouble getting sth like this to work in java: public class
This seemed like it should be easy, but I have had trouble getting it
I have trouble getting the absolute path with cakephp while using a shell. Shell
I am having trouble getting some data from a JSON object which I have
I am having a little trouble getting this to work. I have several anchor
I'm having some trouble getting this to work in a WPF app I'm working
I have some trouble getting this particular kernel patch to compile correctly with my
I'm getting some trouble binding a date from QueryString : I have the following
I have trouble getting a custom ObjectDataSource for an asp:ListView control to work. I
It seems that I have more trouble getting standard Unix things to run on

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.