0
我有一本字典:字典autocompletebox windows phone的C#
Dictionary<string, string> d = new Dictionary<string, string>();
,我把它们放在一个AutoCompleteBox
:
autobox.ItemsSource = d;
仅显示的关键。
<toolkit:AutoCompleteBox x:Name="autobox" ValueMemberPath="Key" >
<toolkit:AutoCompleteBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Key}" Tap="Item_Tap" />
</DataTemplate>
</toolkit:AutoCompleteBox.ItemTemplate>
</toolkit:AutoCompleteBox>
我现在想使用自来水项目,当我按下结果向对应的一对将在MessageBox
显示。
private void Item_Tap(object sender, System.Windows.Input.GestureEventArgs e)
{
var s = sender as TextBlock;
Messagebox.Show(d[s.Text]);
}
但是,当我点击一个结果什么都不会出来。我哪里做错了?
感谢帮助
是你的事件Item_Tap甚至打? – Ehsan
它与我的列表框,但我猜项目点击不适合自动完成框。 – Turbonis
TextBlock_MouseEnter我这是我的问题的适当事件之一。我已经开始工作了。谢谢回复 – Turbonis