Tutorial – InputScope Property in Input Controls Windows Phone 7 ( WP7 )

Hey Guys. Hope you liked my previous post for creating a simple Windows Phone 7 navigation application.

So in this post we will learn as how how can we optimize the virtual keyboard on WP7 for various input controls.

Open the solution we created in the previous post for creating a simple Windows Phone 7 navigation application or else you can download the solution here.

  • Now open contact.xaml in Expression Blend and go to the ContentPanel inside LayoutRoot. Now open the properties of ContentPanel and expand the layout properties and then set the VerticalScrollBarVisibility to Auto

 

VerticalScrollBar

VerticalScrollBar

  • Select ContentPanel in the design surface in the centr and then double click the grid contol in the toolbar. This will add a grid inside the ContentPanel. Now right click the grid and select AutoSize –> Fill.

 

VerticalScrollBar

VerticalScrollBar

  •  Now just just drang and drop TextBlocks and TextBoxes as show in the image below:

    TextBoxes & TextBlocks

    TextBoxes & TextBlocks

  • Now come the coolest feature in input controls. It is a property called InputScope. Now select the TextBox for Phone and go to properties –> common properties –> InputScope and set it to TelephoneNumber. Similarly change the testbox properties of other contols to below specified values and you will see the magic when you run the application and all this is done without writing any code.

            First Name textbox: Set InputScope to PersonalGivenName
Last Name textbox: Set InputScope to PersonalSurName
Email textbox: Set InputScope to EmailUserName
            Web Site textbox: Set inputScope to Uri
            Address textbox: Set InputScope to AddressStreet
            City textbox: Set InputScope to AddressCity
            State textbox: Set InputScope to AddressStateOrProvince

InputScope

InputScope

  • Now while setting the input scope you might have seen a large number of options but thats not the full list. The full list of the InputScope instances is below:

    InputScope instances

    InputScope instances

Download the source code by clicking on the button [button link=”http://minus.com/mV0RoTjnG” style=”download” color=”green”]Download Source Code[/button]
Do let me know your feedback on this post. Thanks

  • Ubuntu User

    I visit your site for tutorials, and this site is awesome! But your site loads very slow in comparison to other sites!. I am on 30mb dsl line. Kindly please optimise your site. Looking forward for more tutorials.

  • Reggie Gloss

    There’s noticeably a bundle to find out about this. I assume you made certain nice points in features also.

  • ANUJ RAWAT

    Thanks for visiting my blog!, i moved my site to HostGator, now site load time is 90% according to google page speed test.Looking forward to optimize it bit a lot.

  • I like this web blog very much so much superb information. “The great thing about democracy is that it gives every voter a chance to do something stupid.” by Art Spander.

  • ixus

    Hi there just wanted to give you a brief heads up and let you know a few of the pictures aren’t loading properly. I’m not sure why but I think its a linking issue. I’ve tried it in two different web browsers and both show the same results.

  • Abhishek

    Thanks a lot. We will have a look. Would you mind tellling which posts were having issue.