How to implement an AutoCompleteBox on Windows Phone 7
I have a Textbox on my WP7 GUI, which I would like to Bind to a generic list stored in IsolatedStorage. The aim would be, to supply a feature like 开发者_StackOverflow社区the AutoCompleteBox in WPF, which seems to be missing in WP7 Silverlight. I want to provide suggestions based on the entries in the favorites list as the user types in text. Matching would be basic match on string.beginsWith(string foo).
Any suggestion on how I could accomplish this?
EDIT: Tried Matthieus suggestion, but no luck. Downloaded the library and added all necessary references. Then tried scenario no. 5 mentioned on nikhilk.net. Both TextBox as well as XTextBox give me an error when I try to add either or . Both say:
The type (TextBox | XTextBox) does not support direct content.
So no luck on that front... other suggestions?
Have you tried using the Silverlight 3 SDK's AutoCompleteBox? You can alter the styles to suit your application but the AutoCompleteTextBox works well for Windows Phone 7. This forum post could be a starting point if you wanted to implement your own autocomplete textbox.
I would give a look to Silvelright FX Autocomplete Textbox ( http://www.nikhilk.net/Silverlight-AutoComplete.aspx ), it's for Silverlight Desktop but it has more chance to be compatible with WP7 than a WPF one.
精彩评论