Multiline textbox in Windows Phone 7

 
Rate This


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)

设置AcceptsReturn 属性,按回车自动换行。

设置TextWrapping 属性,只有输入到边界的时候才能换行,不具备按回车自动换行的功能

See more Windows Phone 7 posts here

Enjoy while coding..!

Thanks,

Naga Harish.

About Naga Harish Movva

posted on 2011-05-30 13:17  tonylx  阅读(580)  评论(0编辑  收藏  举报