Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The data binding that is setup on <code>lblTime</code> is set on the object reference by <code>AppSettings.Instance.SelectedAuction</code> at the time of the call to <code>AddBinding</code>. The databinding subscribes to the <code>PropertyChanged</code> event on that object. Changing the <code>SelectedAuction</code> on your <code>Instance</code> 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 <code>CurrentAuction</code>, that instance will not be garbage collected)</p> <p>You need to instead setup the data binding so that it can listed for events on the <code>Instance</code> object. You would have to set the binding to <code>"CurrentAuction.EndDate"</code>. This will not work directly (* see note below), but there is a helper object, <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.bindingsource.aspx" rel="nofollow noreferrer">BindingSource</a>, that can be put in the middle that will support that binding. Below is an example:</p> <pre><code>BindingSource bs = new BindingSource(); bs.DataSource = AppSettings.Instance; lblTime.DataBindings.Add("Text", bs, "CurrentAuction.EndDate", false, DataSourceUpdateMode.OnPropertyChanged); </code></pre> <p>Note: It will work without a <code>BindingSource</code> in 3.5, but not in 4.0, see <a href="https://stackoverflow.com/questions/8894103/does-data-binding-support-nested-properties-in-windows-forms">Does data binding support nested properties in Windows Forms?</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload