gpt4 book ai didi

c# - ScrollViewer 不滚动

转载 作者:太空狗 更新时间:2023-10-29 22:53:29 24 4
gpt4 key购买 nike

我想要一个包含 3 个组件的接口(interface),一个接一个。第一个是 ListView,另外两个是 Grids。

由于组件会在右侧溢出,所以我想将它们放在一个ScrollViewer中。我没有成功。我试图做一个非常简单的例子来尝试,但即使是这个例子也失败了。

    <ScrollViewer Grid.Column="1" Grid.Row="2" HorizontalAlignment="Left" VerticalAlignment="Top" Width="600" Height="400">
<StackPanel Width="1200" Height="400" Orientation="Horizontal">
<Border Background="AntiqueWhite" Width="400" Height="400" HorizontalAlignment="Left" VerticalAlignment="Top" />
<Border Background="Blue" Width="400" Height="400" HorizontalAlignment="Left" VerticalAlignment="Top" />
<Border Background="LimeGreen" Width="400" Height="400" HorizontalAlignment="Left" VerticalAlignment="Top" />
</StackPanel>
</ScrollViewer>

如您所见,ScrollViewer 在 Grid 中。我错过了什么?

最佳答案

尝试在滚动查看器上设置这些属性:-

 <ScrollViewer VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Visible" ZoomMode="Disabled" Grid.Column="1" Grid.Row="2" HorizontalAlignment="Left" VerticalAlignment="Top" Width="600" Height="400">
<StackPanel Width="1200" Height="400" Orientation="Horizontal">
<Border Background="AntiqueWhite" Width="400" Height="400" HorizontalAlignment="Left" VerticalAlignment="Top" />
<Border Background="Blue" Width="400" Height="400" HorizontalAlignment="Left" VerticalAlignment="Top" />
<Border Background="LimeGreen" Width="400" Height="400" HorizontalAlignment="Left" VerticalAlignment="Top" />
</StackPanel>
</ScrollViewer>

这对我来说很正常!

关于c# - ScrollViewer 不滚动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10332867/

24 4 0
文章推荐: c# - 当对象具有集合属性时投影 IQueryable 时 Automapper 失败