Допустим, у меня есть класс:
class Foo
{
public string Bar
{
get { ... }
}
public string this[int index]
{
get { ... }
}
}
Я могу связать эти два свойства, используя "{Binding Path = Bar}" и "{Binding Path = [x]}". Хорошо.
Теперь предположим, что я хочу реализовать 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;
}
Что идет в части, отмеченной ????? (Я пробовал string.Format ("[{0}]", index), и он не работает). Это ошибка в WPF, есть ли альтернативный синтаксис, или просто INotifyPropertyChanged не так мощен, как обычное связывание?