Wednesday, 11 September 2013

Easier way to create a DataContext than implementing INotifyPropertyChanged?

Easier way to create a DataContext than implementing INotifyPropertyChanged?

As far as I know, there are 2 common ways to create a DataContect class,
one is to implement INotifyPropertyChanged and the other one is to derive
from DependencyObject.
Lots of people say the first way of implementing INotifyPropertyChanged is
simpler and I agree.
But I don't agree totally because I think even implementing
INotifyPropertyChanged is not simple enough but very tedious, because I
must rewrite every setter function for the properties and fire the event,
it's mostly copy & paste & modify things, which I dislike a lot. It's not
elegent.
So I'm curious, are there any other ways to create a DataContext, for
example, just derive from some class and all is done?
I know if the datacontext is a collection, there is a very easy way to do
it, just inherit from ObservableCollection<>, which I think is a very good
solution. But how about other classes?
Some 3rd party framework?

No comments:

Post a Comment