I am creating a textbox dynamically via code, and adding it to the LayoutRoot. I want the textbox to support multiline, so I have set the AcceptsReturn property to true and TextWrapping property to Wrap. I read in another question that to set the Height as Auto, we have to use double.NaN, and I have done this. But, when I add it, its height is infinite, and covers up the whole space. I just want the textbox to be of a single line initially and let it increase the height when lines are added to it. Please help me with this solution.
I am creating a textbox dynamically via code, and adding it to the LayoutRoot.
Share
Wrap your
TextBoxin aStackPanel. If you’re doing it via code, you could do something like this, for example: