I have a custom class in which I've implemented INotifyPropertyChanged
and I can happily bind this to the .Text
property of a TextBox on a form and have the data flow both ways.
I'm now trying to achieve the same thing with a textbox on a usercontrol, via a property:
public string MyProperty
{
get { return MyPropertyTextBox.Text; }
set { MyPropertyTextBox.Text = value; }
}
I can bind my class to the MyProperty
on the Usercontrol so that the value is set.
But how do I get it so that when I edit the textbox the change is fed back to my class?
Edit:
Not sure I explained myself very well + it's WinForms, not WPF.
The text box itself isn't bound, I wanted the 'TextChanged' event of the textbox to also trigger 'PropertyChanged' of the usercontrol property. Built myself a proof of concept test, got that working, and then managed to implement it in my project.
thanks for the suggestions though.