5

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

由于组件会在右侧溢出,因此我想将它们放在 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 位于网格内部。我错过了什么?

4

1 回答 1

8

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

 <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>

这通常对我有用!

于 2012-04-26T12:12:48.820 回答