我们如何ListView
使行为正确?我试图在我的内部垂直滚动ListView
,我最终能够得到垂直滚动的东西,但是ListView
高度不断扩大!并且设置MaxHeight
没有任何作用。
<StackPanel x:Name="ActivityLog" Margin="0, 201, 0, 0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<ScrollViewer ScrollViewer.VerticalScrollBarVisibility="Visible">
<ListView x:Name="ActivityList" ItemsSource="{Binding Activities}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" BorderBrush="{x:Null}" HorizontalContentAlignment="Center" FontSize="14">
<ListView.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Message}" Background="{x:Null}" HorizontalAlignment="Stretch" Padding="5" TextAlignment="Center" ScrollViewer.VerticalScrollBarVisibility="Auto" ScrollViewer.CanContentScroll="True" />
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</ScrollViewer>
</StackPanel>
我很茫然。请帮忙。如何让列表视图仅垂直滚动,并且从不改变高度,并且从不显示水平滚动条?