If there is a binding OneWayToSource on a target property, and the target property changes from true to false and then back to true, is it guaranteed that the source will be true? or can the changes propagate out of order?
Asked
Active
Viewed 142 times
0
-
Changes cannot propagate out of order. To stick with your example: If the (real) property change true->false->true would be processed out-of-order, say true->(true)->false, how would anybody know what the current/last state of the property is? If your code receives those property changes and does something based on these values that appears to be out-of-order, then that would be another story and not related to the working of bindings. (Note, that i put the second "true" in parantheses, since bindings/dependency properties usually don't telegraph the same value in succession) – Oct 29 '13 at 23:09
-
ah ok. That's what i just wanted to confirm. I am getting weird behavior where my IsSelected property on the view changes true when i click on it, the viewmodel property then updates, but I can then see the viewmodel resetting to false. I can't think of any logical reason then other than the view's isselected value being set to false after my code runs, but I don't see why that is. I thought it might be due to using a treeviewitem as the container for my Itemscontrol, so I tried using a headereditemscontrol as the container and it still has the same problem – James Joshua Street Oct 29 '13 at 23:12
-
the stack trace just says external code:( – James Joshua Street Oct 29 '13 at 23:14
-
Ah, i see. Look here: http://stackoverflow.com/questions/4875751/onewaytosource-binding-seems-broken-in-net-4-0 What you encounter is likely the same stupid Microsoft thing, if you use INotifyPropertyChanged – Oct 29 '13 at 23:14
-
If that is indeed your problem, and you are curious about why MS introduced this behevior, read here: http://karlshifflett.wordpress.com/2009/05/27/wpf-4-0-data-binding-change-great-feature/ – Oct 29 '13 at 23:18