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.