Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

How to Display Suggestions in ‘On-Screen Keyboard’ for a Textbox in Windows Phone App

DZone's Guide to

How to Display Suggestions in ‘On-Screen Keyboard’ for a Textbox in Windows Phone App

· Mobile Zone
Free Resource

Download this comprehensive Mobile Testing Reference Guide to help prioritize which mobile devices and OSs to test against, brought to you in partnership with Sauce Labs.

In the standard Windows Phone functions like messaging or Email App, when you enter a text, you will see the list of suggestions for the text you are typing in the top of the on-screen keyboard.


Similarly, we can display the suggestions for a textbox in the on-screen keyboard in our Windows Phone App, too, with the help of Input Scope (Chat or Text InputScopeName).

Just set the InputScope of the textbox to “Text” like this:

<TextBox Name="textBox1" Text="">

<TextBox.InputScope>

<InputScope >

<InputScopeName NameValue="Text"/> </InputScope>

</TextBox.InputScope>

</TextBox>

If you want to try this in codebehind , you can use the below C# code instead

InputScope inputScope = new InputScope();
InputScopeName inputName = new InputScopeName();
inputName.NameValue = InputScopeNameValue.Text;
inputScope.Names.Add(inputName);
textBox1.InputScope = inputScope;

Run the WP7 Application and start enter few characters in the textbox , you should see the suggestions now :)


 

Analysts agree that a mix of emulators/simulators and real devices are necessary to optimize your mobile app testing - learn more in this white paper, brought to you in partnership with Sauce Labs.

Topics:

Published at DZone with permission of Senthil Kumar, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}