Implementing INotifyPropertyChanged with indexed properties

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
 
J

Joanna Carter [TeamB]

"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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top