I have a TextBox with a TextChanged event. This TextBox is in a StackPanel. If I make a StackPanel.Children.Clear(), the event of my TextBox is not executed.
Perfect for me!
Now, I need to bind my TextBox to the result of a database request. If I make my StackPanel.Children.Clear(), the TextChanged event IS EXECUTED!
Who know I to avoid this execution when the TextBox is Clear() ?
The solution is to Unbind my TextBox WITHOUT EVENT EXECUTION...
clear before the binding:
or better
EDIT - For nested elements:
ClearBindings function: