我使用了 AutoCompleteBox 用户控件。我有一个类型的字典,Dictionary<int,string>
其中包含 ID 和名称。我只想在 AutoCompleteBox 中显示名称。我可以做到
autoCompleteBox1.ItemsSource = dict.Values;
My problem is whenever any name is selected I want to retrieve the id associated with it. 但我不想向用户显示 ID,因为它们是出于内部目的。我该怎么做?