我的 WPF 应用程序中有一个 ComboEdit 控件,该控件由以“联系人”命名的实体绑定。现在我想获取 ComboEdit 的选定值。
<dxe:ComboBoxEdit Name="ddlFirstName" HorizontalAlignment="Left" Margin="125,24,0,0" VerticalAlignment="Top" Width="140" SelectedIndexChanged="ddlFirstName_SelectedIndexChanged"/>
protected void BindAllDropdown()
{
ddlFirstName.ItemsSource = BLL.GetAllContacts();
ddlFirstName.DisplayMember = "FirstName";
ddlFirstName.ValueMember = "ContactID";
ddlLastName.ItemsSource = BLL.GetAllContacts();
ddlLastName.DisplayMember = "LastName";
ddlLastName.ValueMember = "ContactID";
}
我正在尝试使用以下方法获取选定索引更改事件的选定值:
string contid = ddlFirstName.SelectedItem.ToString();
这将返回整个实体,因此无法获取所选值。如何获得选定的值?
帮助表示赞赏!谢谢!