[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework

WPF textbox autogrow

moondaddy

1/24/2008 7:44:00 PM

Using WPF 3.5, I have a textbox with it's TextWrapping property set to
WrapWithOverflow.

When the number of lines increases in the textbox, how can I make the height
of the textbox grow to accommodate the all of the lines?

Also, I will need to go in the other direction and make the height shrink
when the number of lines reduces.

Thanks.

--
moondaddy@newsgroup.nospam


2 Answers

v-lliu

1/25/2008 6:36:00 AM

0

Hi Moondaddy,

In fact, the TextBox control in WPF has already provided the function of
auto expanding/shrinking with the content entered into it.

To get this feature, set the TextWrapping property of the TextBox to Wrap
or set the AcceptReturn property to true and then place the TextBox control
within a StackPanel (if you place the TextBox in a Grid, the auto
expanding/shrinking feature is not available).

In addition, you should not set the Height property of the TextBox to a
specific value. The value of the Height property of the TextBox displayed
in the Properties window should be "Auto".

If the value of the Height property has alreadly been set to a specific
value, e.g. 200 in your project, delete this value in the Properties window
and press Enter and "Auto" will be displayed in the property entry.

Please try my suggestion and let me know the result.

Sincerely,
Linda Liu
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default....
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/de....
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

moondaddy

1/29/2008 7:57:00 PM

0

Thanks Linda, this is good.

"Linda Liu[MSFT]" <v-lliu@online.microsoft.com> wrote in message
news:yekbgyxXIHA.4200@TK2MSFTNGHUB02.phx.gbl...
> Hi Moondaddy,
>
> In fact, the TextBox control in WPF has already provided the function of
> auto expanding/shrinking with the content entered into it.
>
> To get this feature, set the TextWrapping property of the TextBox to Wrap
> or set the AcceptReturn property to true and then place the TextBox
> control
> within a StackPanel (if you place the TextBox in a Grid, the auto
> expanding/shrinking feature is not available).
>
> In addition, you should not set the Height property of the TextBox to a
> specific value. The value of the Height property of the TextBox displayed
> in the Properties window should be "Auto".
>
> If the value of the Height property has alreadly been set to a specific
> value, e.g. 200 in your project, delete this value in the Properties
> window
> and press Enter and "Auto" will be displayed in the property entry.
>
> Please try my suggestion and let me know the result.
>
> Sincerely,
> Linda Liu
> Microsoft Online Community Support
>
> ==================================================
> Get notification to my posts through email? Please refer to
> http://msdn.microsoft.com/subscriptions/managednewsgroups/default....
> ications.
>
> Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
> where an initial response from the community or a Microsoft Support
> Engineer within 1 business day is acceptable. Please note that each follow
> up response may take approximately 2 business days as the support
> professional working with you may need further investigation to reach the
> most efficient resolution. The offering is not appropriate for situations
> that require urgent, real-time or phone-based interactions or complex
> project analysis and dump analysis issues. Issues of this nature are best
> handled working with a dedicated Microsoft Support Engineer by contacting
> Microsoft Customer Support Services (CSS) at
> http://msdn.microsoft.com/subscriptions/support/de....
> ==================================================
>
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
>