Let's say I have a class:
class Foo
{
public string Bar
{
get { ... }
}
public string this[int index]
{
get { ... }
}
}
I can bind to these two properties using "{Binding Path=Bar}" and "{Binding Path=[x]}". Fine.
Now let's say I want to implement INotifyPropertyChanged:
class Foo : INotifyPropertyChanged
{
public string Bar
{
get { ... }
set
{
...
if( PropertyChanged != null )
{
PropertyChanged( this, new PropertyChangedEventArgs( "Bar" ) );
}
}
}
public string this[int index]
{
get { ... }
set
{
...
if( PropertyChanged != null )
{
PropertyChanged( this, new PropertyChangedEventArgs( "????" ) );
}
}
}
public event PropertyChangedEventHandler PropertyChanged;
}
What goes in the part marked ????? (I've tried string.Format("[{0}]", index) and it doesn't work). Is this a bug in WPF, is there an alternative syntax, or is it simply that INotifyPropertyChanged isn't as powerful as normal binding?