<ComboBox Height="23" Margin="52,64,33,0" Name="comboBox1"
IsSynchronizedWithCurrentItem="True"
IsEditable="True"
DisplayMemberPath="Value"
SelectedItem="{Binding Path=Number, Mode=TwoWay}"
/>
public class Number : INotifyPropertyChanged
{
private string value;
public string Value
{
get
{
return value;
}
set
{
this.value = value;
this.PropertyChanged(this, new PropertyChangedEventArgs("Value"));
}
}
#region INotifyPropertyChanged Members
public event PropertyChangedEventHandler PropertyChanged = delegate { };
#endregion
}
comboBox1.ItemsSource = new Number[] { new Number() { Value = "One" },
new Number() { Value = "Two" },
new Number() { Value = "Three" }};
当我编辑组合框文本时,我的绑定数据集没有修改。即,目标到源的绑定没有发生。