Hi
Can any one explain me about what is INotifyPropertyChanged.
I saw some thing like PropertyChangedEventHandle, OnPropertyChanged.
I dont know what is this and why it is used for.
Can any one tell what is this and why we need to use with simple example.
Thanks.
Loading

Selva GanapathyPosted Feb 18, 2014, 4:07 AM
The INotifyPropertyChanged is used for binding the AttachedProperty to notify whenever the property get change. Instead of using the AttachedPRoperty with INotifyPropertyChanged interface. You may try to use DependencyProperty which is more effective while binding also avoid some unexpected binding failures. Or use AttachedProperty with INotifyPropertyChanged as per the following C# Code snippet syntax.
Regards,
Selva Ganapathy K
Sanjay DholakiyaPosted Mar 2, 2014, 7:26 PM
Firstly, this interface is only useful if you are using Binding expression.
Now to answer why it is useful.
For wpf or silverlight, you can have following binding modes.
- OneWay
- TwoWay
- OneTime
... etc
Now TwoWay mean, if you change anyting in your view (xaml) then it automatically transfers that value to viewmodel (your binding property). For example,
If you change anything in textbox, it reflects this into FirstName property.
Now lets consider the reverse case.
Let say you write following line into your viewmodel.
FirstName="Vasanth";
When this line is executed, you expect the textbox text to be updated with this value.
To do so, you have to implement INotifyPropertyChanve into you viewmodel and call onPropertyChanged even from your view model to notify (inform) your view that FirstName is changed and that is why please update the Text property of textbox control.
Hope this helps.
- Sanjay
Vasanth KrishnanPosted Mar 8, 2013, 12:50 AM
VulpesPosted Mar 7, 2013, 9:15 AM
http://www.codeproject.com/Articles/41817/Implementing-INotifyPropertyChanged