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. I was basically using System.Windows.Controls.AutoCompleteBox, and I saw the new one so I told myself “Hey! A Phone oriented 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)…. 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.
Did somebody run into this already? If not, any suggestions anyway?
Thanks in advan开发者_开发技巧ce, Cheers
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.
The sample on CodePlex works fine for me.
Can you confirm exactly which versions you are using.
Also, how and why are you wiring up the TextChanged event handler?
This is how I did it:
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);
}
精彩评论