我有一個基類實現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