Introduction:
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.
Building the Sample
- Make sure you’ve downloaded and installed the Windows Phone SDK. For more information, see Get the SDK.
- I assumes that you’re going to test your app on the Windows Phone emulator. If you want to test your app on a phone, you have to take some additional steps. For more info, see Register your Windows Phone device for development.
- This post assumes you’re using Microsoft Visual Studio Express 2013 for Windows.
Description:
Here is the code snippet for you to try out the additional features part of Windows Phone 8.1 SDK:
XAML
<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 SpellChecker, Text Predictions etc. while using TextBox control in your apps or games. You can see below how the Spell Checker and TextPrediction works:
Output Screens:
Note: WindowsPhone 8.0 TextBox control doesn't support above properties.
Note: Please share your thoughts,what you think about this post,Is this post really helpful for you?otherwise it would be very happy ,if you have any thoughts for to implement this requirement in any another way?I always welcome if you drop comments on this post and it would be impressive.
Hi Subbu,
ReplyDeleteIs there any way we can write this header template somewhere and and use it for text boxes everywhere across the application?
Thanks,
Bharath
Wow! these are wonderful tips. Thanks for sharing them with us. Please visit http://goo.gl/j1CNtj
ReplyDelete