Hello to all,

I'm pretty new to Castle AR and I'm doing my first Winform application
with AR.

I have a problem with combobox databinding and I'm sure a lot of
people do what I will do.

My problem:

I have class PersonType and Person:

public class PersonType: AcriveRecordBase<A>
{
 private Int32 id;
 private String description;
 ...
}

public class Person: ActiveRecordBase<B>
{
 private Int32 id;
 private String description;
 private PersonType personType;
 ...
 [BelongTo]
     public PersonType PersonType
        {
            get { return personType; }
            set { personType = value; }
        }
 ...
}

This works all fine. My problem is now on coding the Winform to edit a
Person. I have a bindingsource (bindingsourcePerson) with one instance
from Class Person data bound and 2 controls bound to property Id and
Description. This works fine.

Now I have added a combobox. I fill it with another bindingsource
(bindingsourcePersonTye) that has as datasource = PersonType.FindAll
(). This populates the combobox. As Displaymember I have put the
Description property. The valuemember is empty; because I want that
the combobox returns the selected object itself. The SelectedValue is
bound to the property PersonType from the bindigsoucePerson.

No when I open the window, the combobox don't display the correct
PersonType from the Person I’m editing (all other controls are fine),
but if I select another item from in the combox  (combobox is filled
correctly), it updates class Person and saves changes on the database
correctly.

The only problem I have is when I open the form or change the current
object bound to the bindigsourcePerson. It doesn’t refresh/select the
correct item from the combobox.
Any suggestions?
Has someone a Winform example with a combox where the selectedvalues
is binded to a object property?

Thanks,


Alex B.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to