ComboBox selectedValue in Datagrid control in a Silverlight Page

我的未来我决定 提交于 2019-12-12 02:10:10

问题


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 datagridtemplatecolumn. 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?


回答1:


Here is my code to set the Combobox selectedvalue

<ComboBox Name="cmbCodeParts"
                                      Width="120"
                                      HorizontalAlignment="Left"
                                      ItemsSource="{Binding ElementName=tblRecipe_CodePartsTypeDomainDataSource, Path=Data,Converter={StaticResource debugconverter}}"
                                      DisplayMemberPath="codePartsType"
                                      SelectedValuePath="codePartsTypeID"
                                      SelectedValue="{Binding codePartsTypeID,Mode=TwoWay,Converter={StaticResource debugconverter}}"/>


来源:https://stackoverflow.com/questions/4741460/combobox-selectedvalue-in-datagrid-control-in-a-silverlight-page

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!