tags:

views:

77

answers:

1

I have a TextBox in a column with dynamic column:

<Grid.ColumnDefinitions>
    <ColumnDefinition Width="*"/>
    <ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBox Grid.Column="1" TextWrapping="Wrap"/>

The width of TextBox just fit to users' screen. But when the text in it is longer than its initialized width, the TextBox will increase its width insteed of wrap text inside.

I can assign a static width to TextBox but it's ugly. Is there any way to make its width initialized dynamic but static in run time?

A: 

The code you've posted so far looks fine to me. A little test in Blend confirms the text wraps as expected.

AnthonyWJones