I would like to use databinding when displaying data in a TextBox. I\'m basically doing like:
public void ShowRandomObject(IRandomObject randomObject) {
Alternately:
BindingOperations.ClearBinding(txtName, TextBox.TextProperty)
When available
BindingOperations.ClearBinding(txtName, TextBox.TextProperty)
For older SilverLight versions, but not reliable as stated in comments:
txtName.SetBinding(TextBox.TextProperty, null);
C# 6.0 features enabled
this.btnFinish.ClearBinding(ButtonBase.CommandProperty);
How about:
this.ClearValue(TextBox.TextProperty);
It's much cleaner I think ;)
How about just
txtName.Text = txtName.Text;
You would have to set the value after clearing it anyways. This works in SL4 at least.