WPF dependency property setter not firing when PropertyChanged is fired, but source value is not cha
Posted
by Sandor Davidhazi
on Stack Overflow
See other posts from Stack Overflow
or by Sandor Davidhazi
Published on 2010-04-28T09:38:21Z
Indexed on
2010/04/28
10:03 UTC
Read the original article
Hit count: 466
I have an int dependency property on my custom Textbox, which holds a backing value. It is bound to an int? property on the DataContext.
If I raise the PropertyChanged event in my DataContext, and the source property's value is not changed (stays null), then the dependency property's setter is not fired.
This is a problem, because I want to update the custom Textbox (clear the text) on PropertyChanged, even if the source property stays the same. However, I didn't find any binding option that does what I want (there is an UpdateSourceTrigger property, but I want to update the target here, not the source). Maybe there is a better way to inform the Textbox that it needs to clear its text, I'm open to any suggestions.
© Stack Overflow or respective owner