tags:

views:

52

answers:

0

Hello,

I got a combobox binded to a custom object. Most of the time the following code does not set the custom object (but from times to times it does). Do you have any clue on the issue ?

  //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

After the call of (1), _person.Adress.City is (most of the time) not refreshed...

Thx for your help.