Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
331
Is there a way to force a cell to rebind?
posted

I am dynamically generating a fieldlayout in code behind so that I can achieve a column per month over a variable span of months.  I am providing a binding expression for these dynamically generated fields like: ForecastedCosts[MonthYear].Cost. 

When evaluated, the first part of the binding expression (ForecastedCosts[MonthYear]) may resolve to be a "proxy" object or a "real" object.  The general idea is that transient proxy objects are used for cells that don't have real persisted data but still need to be rendered in the UI.  When the proxy object is edited, the owning collection "swaps" it out for a "real" object.  This mechanism works fine although cells that utilize the following binding ForecastedCosts[MonthYear].Cost never let go of the reference to the proxy object originally at ForecastedCosts[MonthYear].  Subsequent edits to that cell are still being propagated to the proxy object instead of the "swapped" real object.  INotifyPropertyChanged is being subscribed to on the proxy object because the owner of the Cost property is the proxy object when the binding is first set up.

Now, one solution to this is to change the model a bit so that the Cost Property formerly accessed through ForecastedCosts[MonthYear].Cost. can be accessed directly at ForecastedCosts[MonthYear], but I need to get access to other properties that are data-model wise peers of the Cost property.

Is there a way to tell a cell to completely re-evaluate its bindings?

Thanks.

Parents
  • 9694
    posted

    Hello,

    I apologize that no one has yet answered this post. We were inundated with more posts than we had resources to cover. Since that time we have been adding people to the task of making sure every post gets a reply from an Infragistics employee.

    If your data model or View model is using INotifyPropertyChanged, you can notify of any property changed for any property in your view. So one property can trigger a property notification on another by simply raising the PropertyChanged event in the class.

    If you are using BindingList, there is a method you can call - ResetBindings(). This will force the BindingList to update itself from its coupled source.

    You can read more about XamDataGrid binding scenarios in the following blog:
    http://blogs.infragistics.com/blogs/curtis_taylor/archive/2010/11/06/xamdatagrid-101-data-binding-basics.aspx

    Sincerely,

Reply Children
No Data