The problem is that Silverlight bindings do not support PropertyChanged for UpdateSourceTrigger. This means that, by default, a TextBox will update the property attached to the Text when the TextBox loses focus, and the only other way is to explicitly update it in the code, as was done in the example from your link.
You have only two options: update the binding when you click the button or remove focus from the text field when you click the button.
I usually update the binding in the TextChanged event. To do this, I use the extension method:
public static void UpdateBinding(this TextBox textBox) { BindingExpression bindingExpression = textBox.GetBindingExpression(TextBox.TextProperty); if (bindingExpression != null) { bindingExpression.UpdateSource(); } }
lets me just call it code:
textBox.UpdateBinding();
You can also use custom behavior for this.
calum source share