Combobox selecteditem in Solverlight WCF Ria Services project

I'm using VS2010 and SL4, and have added a comboxBox to my xaml page.

I've used ria services and dragged the source from the datasources list, onto the combobox. When I run the project, the combobox displays the correct list of names.

In code, I need to do two things:

1) Read the selecteditem of the comboxbox - Currently when I read the selecteditem.toString(), I get (tablename - 28(or22)), not the name that is displayed. This should be the name that is displayed in the combobox

2) I need to somehow add the Value to the combobox, as you could in ASP.NET, so I can retrieve the selecteditem,(Name) and the SelectedValue(Instance)

Is this possible?

<ComboBox Canvas.Left="63" Canvas.Top="130" Height="23" x:Name="comboMeters" Width="229" DisplayMemberPath="FriendlyName" ItemsSource="{Binding ElementName=meterListDomainDataSource, Path=Data}" >

Open in new window

Who is Participating?
You need to cast the SelectedItem to the type which is represented by the datasource. Then you can get the values.

Check this link
wint100Author Commented:
in this example

What is the 'Name' property?
wint100Author Commented:
Oops, missed the class at the bottom of the page..

What about if I binding to a domainclass?
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.