更新时间:2023-02-11 23:33:25
将您的 TextBox
包裹在 StackPanel
中.如果你通过代码来做,你可以做这样的事情,例如:
Wrap your TextBox
in a StackPanel
. If you're doing it via code, you could do something like this, for example:
public MainPage()
{
InitializeComponent();
var textBox = new TextBox
{
AcceptsReturn = true,
Height = Double.NaN,
TextWrapping = TextWrapping.Wrap
};
var stackPanel = new StackPanel();
stackPanel.Children.Add(textBox);
this.LayoutRoot.Children.Add(stackPanel);
}