WPF多行文本框不';t在usercontrol内呈现为多行
在WPF多行文本框不';t在usercontrol内呈现为多行,wpf,textbox,user-controls,multiline,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
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>
“有人能告诉我为什么吗?”没有看到文本框的父元素就不行。您的文本框看起来不错。现在,您应该关注您的父控件。你能添加你的家长控制代码吗?@Clemens,谢谢你的回复,代码已经更新。那么文本框中的文本在哪里。。。?我仍然没有找到根本原因,我现在使用的是RichTextBox。