Correct way to cancel OnChanging event #903
-
I have an observable property MyProperty that I have an OnMyPropertyChanging event handler coded.
In the event handler, I need to cancel the change is certain conditions are true. What is the preferred way to do that? I don't see a 'cancel' token / parameter so I am trying to simple set the newValue equal to the oldValue but I am not sure if that will work. Any information would be appreciated. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
It is not possible to cancel the event being raised after the property value has changed. If you have a property which has this very specific requirement, you might want to not use the source generator for it and instead implement the logic manually. |
Beta Was this translation helpful? Give feedback.
It is not possible to cancel the event being raised after the property value has changed. If you have a property which has this very specific requirement, you might want to not use the source generator for it and instead implement the logic manually.