下面是我的xaml结构:
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<TextBlock Text = "{Binding Test}" />
<GroupBox Header = "Test" Grid.Row="1">
<TextBlock Text = "{Binding Description}" />
</GroupBox>
</Grid>
我的说明很长,但我的组框中没有垂直滚动查看器显示。我不想为群组设置特定的高度。有人可以帮忙吗?
答案 0 :(得分:0)
您可以设置TextWrapping="Wrap"
并使用ScrollViewer
将其打包在HorizontalScrollBarVisibility="Disabled"
中:
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<TextBlock Text="{Binding Test}" />
<GroupBox Header="Test" Grid.Row="1">
<ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
<TextBlock TextWrapping="Wrap" Text="{Binding Description}" />
</ScrollViewer>
</GroupBox>
</Grid>