Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
85
Data Binding on XamComboEditor?
posted

Alrighty, I've been beating my head against a wall here for some time trying to figure out how to do something that, to me at least, should be very simple.

I have a XamComboEditor that I want to function as a lookup, for lack of a better term. I need to figure out how I can pass along a foreign key value (seems like there should be a ValueMemberPath property and a Value property to accomplish what I'm after) to the XamComboEditor and get that value to change the SelectedItem and the display text appropriately. Consequently, when the user changes their selection in the XamComboEditor, I need to have that change cascade back to the field I used as the foreign key.

Simplified scenario:

An Customers table with a StateID field that references the States table that also contains a StateID field and a Name.

I want to be able to bind the StateID field from the Customers table to the StateID field in my States list which I would use as the ItemsSource property for the XamComboEditor and have the SelectedItem change appropriately.

My frustration may be due to simply not understanding Silverlight data binding well enough yet, but to date, the only way I have found to accomplish this it to perform a search of my States list to find the appropriate State item and set that as the SelectedItem programmatically. That's not so bad when you only have one XamComboEditor, but as the number of XamComboEditors increases, this is going to quickly become a pain point. I'm wondering if there's a better way for me to do this? Or will I always be stuck programmatically doing things this way for lookups?

Parents Reply Children
No Data