ComboBox selectedValue在Datagrid控件中的Silverlight页面 [英] ComboBox selectedValue in Datagrid control in a Silverlight Page

查看:131
本文介绍了ComboBox selectedValue在Datagrid控件中的Silverlight页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Silverlight页面,我有一个按钮控件和一个Datagrid。
Silverlight页面上的Click事件导航到Silverlight子窗口。
Silverlight页面上的DataGrid显示所有客户的订单。
Silverlight子窗口有一个数据形式和文本框以及一个组合框。
在ChildWindow中保存数据没有问题。
当我单击ChildWindow上的确定时,问题开始。
Silverlight页面上的datagrid填充了Orders信息。
DataGrid中的一列是CustomerID列。
为了使用户更好地了解其顺序,我决定将一个组合框添加到
datagridtemplatecolumn。该组合框完全绑定到CustomerDataSource。
但是对于每个订单,我希望它显示相应的客户名称。
但是这不会发生。
我如何实现这个?

解决方案

这是我的代码设置Combobox selectedvalue

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


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?

解决方案

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}}"/>

这篇关于ComboBox selectedValue在Datagrid控件中的Silverlight页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆