Skip to main content

Microsoft Silverlight

Databinding problem with comboboxRSS Feed

(0)

karlssonkatrin
karlsson...

Member

Member

1 points

77 Posts

Databinding problem with combobox

Hi,

I have one configuration object that contains a list of strings, representing a persons civilstatus:

married, divorced, singel etc.

I also have a person object that has a property CivilStatus of type string.

I want to populate the combobox with the values from the configuration object. This works fine, when I set the DataContext to this object in .cs  and the ItemSource in xaml to the string list.

What I know want to accomplish is to set the selected Item to the Person objects property CivilStatus (even though the datacontext is set to the configuration object) and I want to reflect any changes in the combobox to the personobjects property Civilstatus.

Is this possible in SL3?

Regards Katrin 

 

jay nanavati
jay nana...

Contributor

Contributor

3388 points

624 Posts

Re: Databinding problem with combobox

Try to use INotifyPropertyChanged interface for your persons class. so upon propertychanged, the binding will automatically update the civilstatus as well.

Jay K Nanavaty
www.technologyopinion.com
Mark as answer if it helps. It will also help others...

karlssonkatrin
karlsson...

Member

Member

1 points

77 Posts

Re: Re: Databinding problem with combobox

 

I have my classes generated from a service reference so I don't want to update them. I was hoping to use databinding in some way? 

  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities