我有一个绑定到自定义对象的组合框。大多数情况下,以下代码不会设置自定义对象(但有时会这样做)。你对这个问题有任何线索吗?
//In the main form
_person = new Person();
_citySelector.DataBindings.Add("SelectedCity", _person, "Adress.City"); //Adress is an object, city too
.------------------
//A property of _citySelector (city selector derives from UserControl and implements INotifyPropertyChanged )
public City SelectedCity
{
get { return ultraComboCities.SelectedRow.ListObject as City;}
set
{
//Horrible but there is no selector.SelectedValue =
foreach (UltraGridRow row in ultraComboCities.Rows)
{
if(row.ListObject as City == value)
{
ultraComboTiers.SelectedRow = row;
RaisePropertyChanged("SelectedCity");
return;
}
}
}
}
.------------------
//I call the following code on my city select object
//(1)
SelectedTier = City.Get("London"); //ultraComboCities was first populated with cities object including London
在(1)的电话之后,_person.Adress.City(大部分时间)都没有刷新......