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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T08:52:50+00:00 2026-06-17T08:52:50+00:00

I am databinding an object value to a label and it wont refresh. lblTime.DataBindings.Add(new

  • 0

I am databinding an object value to a label and it wont refresh.

lblTime.DataBindings.Add(new Binding("Text", AppSettings.Instance.SelectedAuction, "EndDate", false, DataSourceUpdateMode.OnPropertyChanged));

The bind works and using a messagebox, I know the value is changing. I am correctly using the INotifyChanged but it wont work.
Changing individual values works, say:

AppSettings.Instance.SelectedAuction.EndDate = ((Auction)lbAuctions.SelectedItem).EndDate;

But I want to replace the whole object, and it wont update:

AppSettings.Instance.SelectedAuction = (Auction)lbAuctions.SelectedItem;

Why is this? I can make individual values refresh but not the object itself…

public Auction SelectedAuction
    {
        get { return this.selectedAuction; }
        set
        {
            this.CheckPropertyChanged<Auction>
            ("SelectedAuction", ref this.selectedAuction, ref value);
        }
    }

Is it that there is another method to use when replacing the object itself or something additional i need to ref?

  • 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-17T08:52:51+00:00Added an answer on June 17, 2026 at 8:52 am

    The data binding that is setup on lblTime is set on the object reference by AppSettings.Instance.SelectedAuction at the time of the call to AddBinding. The databinding subscribes to the PropertyChanged event on that object. Changing the SelectedAuction on your Instance doesn’t change that. The data binding is still subscribed on the original object. (This also means you have a memory lead, since the data binding references the original CurrentAuction, that instance will not be garbage collected)

    You need to instead setup the data binding so that it can listed for events on the Instance object. You would have to set the binding to "CurrentAuction.EndDate". This will not work directly (* see note below), but there is a helper object, BindingSource, that can be put in the middle that will support that binding. Below is an example:

    BindingSource bs = new BindingSource();
    bs.DataSource = AppSettings.Instance;
    lblTime.DataBindings.Add("Text", bs, "CurrentAuction.EndDate", false, 
          DataSourceUpdateMode.OnPropertyChanged);
    

    Note: It will work without a BindingSource in 3.5, but not in 4.0, see Does data binding support nested properties in Windows Forms?

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

Sidebar

Related Questions

I have a label control that is bound to a object collection like lblUser.DataBindings.Add(new
I'm trying to bind DateTimePicker control to a property of an object. DatePickerDataSale.DataBindings.Clear(); DatePickerDataSale.DataBindings.Add(Text,
In a nutshell, this databinding works correctly tbTotalTaxDue.DataBindings.Add(Text, I, TotalTaxDue); Namely, when I enter
I have to run a SQL query using a text value in a label
I am having trouble databinding a TextBox.Text property to a object's method. The idea
I'm completely new to databinding in WPF, and I'm trying to bind an object
I am having some serious trouble creating a WPF TreeView with an Object databinding.
I am databinding a GridView to an object datasource. The gridview contains a TemplateField
What is the format for databinding to a complex object? I have a linq
When talking about object marshalling in most of the Java-XML data binding APIs, it

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.