Implementing INotifyPropertyChanged with indexed properties

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I'm using indexed properties in an object which acts as the binding source.
How can I implement INotifyPropertyChanged for that object so that when the
indexed property is updated, binding target is updated?

To be more specific please find the code below..

public class ClassA : INotifyPropertyChanged

{

public object this[int field]

{

get

{

//Some code

}

set

{

//Some code

OnPropertyChanged(); // What is the parameter for OnPropertyChanged call???


}

}



#region INotifyPropertyChanged Members

public event PropertyChangedEventHandler PropertyChanged;

protected void OnPropertyChanged(string propName)

{

if (this.PropertyChanged != null)

{

PropertyChanged(this, new PropertyChangedEventArgs(propName));

}

}

#endregion

}


Thanks,

Gokul
 
"Gokul" <[email protected]> a écrit dans le message de (e-mail address removed)...

| I'm using indexed properties in an object which acts as the binding
source.
| How can I implement INotifyPropertyChanged for that object so that when
the
| indexed property is updated, binding target is updated?

The default indexer property of a class is called "Item" but, since you can
declare more than one indexer, I am not sure what the others are called.

Joanna
 
Back
Top