Hi, I'm using Silverlight 4 and I want to create a childwindow with a TextBox, that the TextBox's width will be constant and it's height will be resized according to the size of the assigned text. Any ideas how can I do it?
+3
A:
Set the Width property on your textbox to whatever you want it to stay at -- then set the TextWrapping property to "Wrap", and then make sure the content control holding is not set up to stretch it vertically and it will do what you want (text wraps and the box grows vertically to contain it as you enter stuff).
Ultra simple example:
<Grid x:Name="LayoutRoot" VerticalAlignment="Top">
<TextBox Name="tbTest" TextWrapping="Wrap" Width="300" />
</Grid>
David Hay
2009-12-22 15:54:51