我有一个基类实现INotifyPropertyChanged
:INotifyPropertyChanged的和线程
protected void OnNotifyChanged(string pName)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(pName));
}
}
public event PropertyChangedEventHandler PropertyChanged;
我有一个属性Latitude
派生类,像这样:
private double latitude;
public double Latitude
{
get { return latitude; }
set { latitude = value; OnNotifyChanged("Latitude"); }
}
我的派生类中也有一个方法Fly
其操纵Latitude
。
我也有一个形式绑定到我的派生类的Latitude
一个TextBox:
txtLat.DataBindings.Clear();
txtLat.DataBindings.Add("Text", bindSrc, "Latitude");
一个线程用于揭开序幕Fly
像这样:
Thread tFly = new Thread(f.Fly);
tFly.IsBackground = true;
tFly.Start();
当Latitude
变化,一引发异常:
DataBinding cannot find a row in the list that is suitable for all bindings.
@WulfgarPro增加了两个*不同的*例子 – 2011-01-28 06:48:19