假设我有一节课:
class Foo
{
public string Bar
{
get { ... }
}
public string this[int index]
{
get { ... }
}
}
Run Code Online (Sandbox Code Playgroud)
我可以使用"{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 …Run Code Online (Sandbox Code Playgroud) wpf ×1