Windows Phone 8.1 TextBox Control - What’s new for #WPDev?


logo

Windows Phone 8.1 is already there for developers and developers already started building and/or upgrading their apps to support the new changes in Windows Phone 8.1. The RC version of Visual Studio 2013 Update 2 is already there with WP8.1 SDK preloaded.

 

In this post, we are going to discuss the enhanced TextBox control which came with additional features like place holder text, header content etc.

 

The TextBox control in Windows Phone 8.1 SDK supports setting Header text. You can also modify the header template to place explicit content and/or design it as per your need. This was asked by many developers to provide in the default control, as some third party libraries already provide this feature.

 

Also, it supports “Place Holder Text”, that means, you can now set Watermarked Text in your TextBox control. This was also part of some third party library vendors but was somehow missing in Windows Phone SDK. As these are now available directly in your default control, you can now use this without any additional cost or design efforts.

 

 

Windows Phone 8.1 - TextBox Control with Header and Custom Header (www.kunal-chowdhury.com)        Windows Phone 8.1 - TextBox Control with support to enable/disable Spell Checker (www.kunal-chowdhury.com)

 

Here is the code snippet for you to try out the additional features part of Windows Phone 8.1 SDK:

 

<StackPanel Margin="10">
    <TextBox Header="Header"/>
    <TextBox Header="Custom Header">
        <TextBox.HeaderTemplate>
            <DataTemplate>
                <TextBlock Text="{Binding}" FontSize="18" Foreground="Yellow"/>
            </DataTemplate>
        </TextBox.HeaderTemplate>
    </TextBox>
    <TextBox Header="Spell Check Enabled" IsSpellCheckEnabled="True"/>
    <TextBox Header="Spell Check Disabled" IsSpellCheckEnabled="False"/>
    <TextBox Header="Text Prediction Enabled" IsTextPredictionEnabled="True"/>
    <TextBox Header="Text Prediction Disabled" IsTextPredictionEnabled="False"/>
    <TextBox Header="Place Holder Text" PlaceholderText="Watermarked text"/>
</StackPanel>

 

Additionally, you can also add/remove support for Spell Checker, Text Predictions etc. while using TextBox control in your apps or games. You can see below how the Spell Checker and Text Prediction works:

 

Windows Phone 8.1 - TextBox Control with Text Prediction enabled (www.kunal-chowdhury.com)        Windows Phone 8.1 - TextBox Control with Text Prediction disabled (www.kunal-chowdhury.com)

 

I hope, this small post will provide you some information about using the enhanced TextBox control in your Windows Phone 8.1 apps or games. I am going to share out some more information on the other controls as and when I explore them. Till that time, happy reading and keep exploring.

 

Don’t forget to connect with me on Twitter, Facebook and Google+ to get my updates. Subscribe to my blog’s RSS feed and/or email newsletter to get the immediate update about my posts. Any queries, let me know and I will try to reply you as soon as I can after my busy schedule.

 


If you have come this far, it means that you liked what you are reading. Why not reach little more and connect with me directly on Twitter , Facebook , Google+ and LinkedIn . I would love to hear your thoughts and opinions on my articles directly. Also, don't forget to share your views and/or feedback in the comment section below.

5 comments

  1. Thanks! I'm waiting for more tutorials.

    ReplyDelete
  2. Hi,
    Thank you for post this blog.
    But i can not get Placeholder and Header property to Textbox in windows phone 8.1 Silverlight application developement.
    Please guid me.

    Thank you.....

    ReplyDelete
    Replies
    1. Hi Kamlesh,

      It's applicable only to WP 8.1 Universal (RT) apps.

      Regards,
      Kunal Chowdhury

      Delete
  3. Better placeholder text should shown, even the the textbox got focus (but with no text). That gives a better user experience.

    ReplyDelete
  4. It is my lumia 535 i am not able to fix prediction sating please how ?

    ReplyDelete


 
© 2008-2016 Kunal-Chowdhury.com - Microsoft Technology Blog for developers and consumers | Designed by Kunal Chowdhury
Back to top