简体   繁体   English

WP7 AutoCompleteBox疯了

[英]WP7 AutoCompleteBox going crazy

Good morning all, 大家早上好,

I'm wondering, since the last WP7 sdk update there's a new AutoCompleteBox included in the ns: Microsoft.Phone.Controls. 我想知道,自从上次WP7 sdk更新以来,ns中包含了一个新的 AutoCompleteBox:Microsoft.Phone.Controls。 I was basically using System.Windows.Controls.AutoCompleteBox, and I saw the new one so I told myself “Hey! 我基本上是在使用System.Windows.Controls.AutoCompleteBox,我看到了新的,所以我对自己说:“嘿! A Phone oriented AutoCompleteBox ! 面向电话的AutoCompleteBox! Let's replace the oldy one”. 让我们替换旧的”。 The thing is that, it is buggy… Actually It doesn't seem to work at all, when you click on it, type a letter you get autocompletion, you choose a value the Text property gets filled with it alright BUT the keyboard never goes off (either after taping elsewhere or switching the screen)…. 事实是,它有很多错误……实际上似乎根本不起作用,当您单击它时,键入自动完成的字母,然后选择一个值,Text属性就被填充好了, 但是键盘永远不会消失关闭(在其他地方点击或切换屏幕后)…。 It has another big flaw… The TextChanged event is never triggered… So either there's something wrong in the update, or the emulator is going nut. 它还有另一个很大的缺陷……TextChanged事件永远不会触发……因此更新中出现了问题,或者仿真器发疯了。

Did somebody run into this already? 有人碰到这个了吗? If not, any suggestions anyway? 如果没有,仍然有什么建议吗?

Thanks in advance, Cheers 预先感谢,干杯

Miloud B. Miloud B.

The November Update to the Silverlight Toolkit for Windows Phone was the first time an "official" AutoCompleteBox has been made avaialble for the phone. Windows Phone的Silverlight工具包11月更新是首次为手机提供“官方” AutoCompleteBox。

The sample on CodePlex works fine for me. CodePlex上的示例对我来说效果很好。

Can you confirm exactly which versions you are using. 您能否确切确认使用的是哪个版本。
Also, how and why are you wiring up the TextChanged event handler? 另外,如何以及为什么连接TextChanged事件处理程序?

This is how I did it: 这是我的方法:

xaml: xaml:

<toolkit:AutoCompleteBox VerticalAlignment="Top" ItemsSource="{StaticResource words}" Margin="0,12" TextChanged="AutoCompleteBox_TextChanged" />

Code: 码:

    private void AutoCompleteBox_TextChanged(object sender, System.Windows.RoutedEventArgs e)
    {
        // arbitrary use of MessageBox just to confirm getting value entered
        MessageBox.Show(((AutoCompleteBox)(sender)).Text);
    }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM