Multiline textbox in Windows Phone 7

In this post I am going to explain about Textarea(Multiline) in windows phone 7 (wp7). We did not have textarea control, but we can create textarea with Textbox itself. Even for textbox there is no property called Mutiline=”True”. It is easy to do check it..

In Silverlight for Windows Phone didn’t have textarea control. So, we need to use same Textbox as a textarea by changing few properties like AcceptsReturn value to True (AcceptsReturn=”True”), to allow enter key in the textbox. we can see TextWrapping property for wrap the text automatically (TextWrapping=”Wrap”). So, the overflow text will just shown in separate  line. Re-commanded : to get Textarea look we need to set the height , for example height=”160″, see this XAML code

<TextBox x:Name=”txtArea”  AcceptsReturn=”True” Height=”160″ TextWrapping=”Wrap” />

in this below image, first I used just TextWrapping=”Wrap” with height, so if I type more set in that it will align in new lines.

But in second, I used AcceptsReturn=”True” with height. I can just type few words and press enter it will move  to new line.

Check with this image

Multiline textbox in windows phone 7 (WP7)

Multiline textbox in windows phone 7 (WP7)

See more Windows Phone 7 posts here

Enjoy while coding..!

Thanks,

Naga Harish.

  • gilang

    thanks for this simple idea :)

    • Harshal

      It’s really good.But how to move up and down in textbox.

      • http://shareourideas.com/ Rish Movva

        Hi Harshal, There are 2 ways:
        1) Check with “Feedback to Nokia” – That text area size is increasing based on Content.

        2) Second option end user need to use cursor point to move up and down.
        Check with Screen shot, when user move down (or up) we can see small
        arrow icon towards down (or up)

  • Business Phone System

    ASP.NET in Windows Mobile 7 has no property for the textbox like Multiline but textarea will create with Textbox itself.We use the textbox as textarea for changing some properties like AcceptsReturn value to True in Window phone 7.Th best and the informative information which i like that we can see TextWrapping property for wrap the text automatically.

  • AeyB

    Thanks for this :)

  • Gaurav

    Thank you Bhai log….:D