【发布时间】:2016-01-03 11:03:46
【问题描述】:
在 c# 上的 WPF 上我有组合框
<ComboBox x:Name="listCombobox" />
然后我添加它像
var list = new[]
{
new { Number = 1, Name = "Smith" },
new { Number = 12, Name = "John" } ,
new { Number = 14, Name = "Bon" }
}.ToList();
foreach (var item in list)
{
listCombobox.Items.Add(item.Name);
}
我想在组合框中看到名称(就像现在一样)
但是当我选择时,在后面的代码中我会看到不是我选择的名称 我想查看选中的号码
谢谢!
【问题讨论】:
-
看看这个 SO 答案。 stackoverflow.com/questions/19071664/…