在silverlight 2.0中。我有一些内容,我想垂直滚动和水平包装。在控件中,我有一个停靠面板。DockPanel的最后一个子元素是ScrollViewer,它填充了DockPanel
<UserControl x:Class="MyProject.MyControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:WinControls="clr-namespace:Microsoft.Windows.Controls;
assembly=Microsoft.Windows.Controls"
Width="400" Height="300">
<WinControls:DockPanel LastChildFill="True">
...
<ScrollViewer x:Name="MessageScroll" HorizontalScrollBarVisibility="Hidden"
VerticalScrollBarVisibility="Auto" BorderThickness="0" >
<Controls:TextDisplay x:Name="TextDisplay"></Controls:TextDisplay>
</ScrollViewer>
<UserControl x:Class="MyProject.TextDisplay"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<TextBlock x:Name="TextDisplayText" TextWrapping="Wrap">
</TextBlock>
</UserControl>
我想做的是:文本显示应该占据控件的主要区域,
如果高度不合适,则使用垂直滚动条。当消息在水平方向上过长时,应将其换行。