I have a simple property on my view model that is of type string. I want to bind this to a textbox so that changing the textbox updates the string and changing the string updates the textbox. Do I REALLY have a write a wrapper class around the string type that implements INotifyPropertyChanged, or am I missing something incredibly simple here?
Share
It’s really easy to implement INotifyPropertyChanged. But what I would do, ViewModel classes almost always (if not always) inherit from DependencyObject; I would do this text property a DependencyProperty, which automatically notifies changes to whatever it’s bound to. You can use the propdp shortcut in C# (in visual studio 2008, not sure if 2005 too) to create a DependencyProperty faster, just type propdp and hit the Tab key twice. It would look something like this: