Hi
I am trying to understand how you raise event when you implement INotifyPropertyChange interface explicitly
I am new to c# (used to program in vb.net) so bear with me.
What I am trying to do is that only when a property changes I raise an event
in .net 1.1 you Would do the following
public class Employee : INotifyPropertyChanged { public event PropertyChangedEventHandler PropertyChanged; private string mLastName; public string LastName private void OnPropertyChanged(string propName) |
which still works on 2.0 however if I as said you implement the
INotifyPropertyChange explicity VS 2005 will generate the following
class Employee2 : INotifyPropertyChanged { private string mLastName; public string LastName #region INotifyPropertyChanged Members event PropertyChangedEventHandler INotifyPropertyChanged.PropertyChanged #endregion
|
My questions
How do you use the "ADD and Remove method in the event generated
HOw do you raise the event in the property
Thanks a lot for your help

Problem raising Event with INotifyPropertyChange (ADD and Remove )New in 2.0?Need help
mjhoagland
private PropertyChangedEventHandler propertyChanged;
event PropertyChangedEventHandler INotifyPropertyChanged.PropertyChanged
{
add { this.propertyChanged += value; }
remove { this.propertyChanged -= value; }
}
private void RaisePropertyChanged(string propertyName)
{
if (this.propertyChanged != null)
{
this.propertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
The C# Programming Guide on MSDN also has an article on this: "How to: Implement Two Interfaces that Have an Event with the Same Name."
JAlexandrian
Thank you very much kevin that is exacly what I was looking for.
I searched for ages on google,I must be keying the wrong words.
Gabriel