Click here to Skip to main content
15,935,728 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
I have a Silverlight Page where I have the a button control and a Datagrid. The Click event on the Silverlight Page navigates to a Silverlight Child Window. The DataGrid on the Silverlight Page displays the Orders of all Customers. The Silverlight Child Window has a dataform and textfields and a combo box of customers. There is no issue with saving the data on the ChildWindow.

The issue starts when I click OK on the ChildWindow. The datagrid on the Silverlight page is populated with the Orders info. One of the columns in the DataGrid is the CustomerID column. To make the user better understand whose order it is I decided to add a combo box to the
datagridtemplate column. The combobox binds perfectly to the CustomerDataSource. But for each order i want it to display the corresponding Customer Name. But this does not happen. How can I achieve this?
Updated 19-Jan-11 11:24am

1 solution

The Selection completely depends on the SelectedValuePath. Check if whether is are setting CustomerID (which should be available in CustomerDataSource) as SelectedValuePath.

Let me put it simple,

If you haven't specified the SelectedValuePath, you need to pass Customer as SelectedValue

If you have specified SelectedValuePath as CustomerID, you need to pass CustomerID as SelectedValue.

Something like below,

<ComboBox SelectedValuePath="CustomerID" SelectedValue="{Binding Path=CustomerID}" ItemsSource="{Binding Source={StaticResource CustomerDataSource}}" />
Share this answer
Learning_abc 19-Jan-11 23:57pm    
Hi Venkatesh,

can you post a sample of what you are trying to explain?
Thanks in Advance.
Venkatesh Mookkan 20-Jan-11 0:01am    
Updated the answer.
Learning_abc 20-Jan-11 9:52am    
Hi Venkatesh,

This does not work for here.
The combobox gets populated with a list of customers but i cannot set the CustomerName for that order on top of the ComboBox.
Venkatesh Mookkan 20-Jan-11 9:53am    
In that case post the code. Let me see if I can help you.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900