WPF多行文本框未在usercontrol内呈现为多行

时间:2017-07-11 07:03:56

标签: wpf textbox user-controls multiline

UserControl内,我添加TextBox,如下所示

xaml中的

<UserControl x:Class="****"
         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
<UserControl.Resources>
</UserControl.Resources>
<Grid>
    <ScrollViewer Grid.Row="0" Visibility="{Binding ElementName=PromotionDetailsGroupBox, Path=Visibility}" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="260"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="600"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <GroupBox Header="Settings" Grid.Row="1" Grid.Column="0" Margin="4">
                <Grid Margin="10 20 0 0">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="30"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                    </Grid.RowDefinitions>
                    <TextBlock Grid.Row="2" Margin="18 0" Width="100" HorizontalAlignment="Left" VerticalAlignment="Center">Message</TextBlock>
                    <TextBox Grid.Row="2" Margin="10 0 4 4" TextWrapping="Wrap" AcceptsReturn="True" Width="100" MaxLength="100" Height="60"></TextBox>
            </GroupBox>           
    </Grid>
    </ScrollViewer>
</Grid>

运行应用程序,TextBox始终显示为一行。

有人可以告诉我为什么吗? 提前谢谢。

0 个答案:

没有答案