Windows Phone 8.1 - ListView上的水平可滚动StackPanel

时间:2015-01-28 22:24:08

标签: listview scroll windows-phone-8.1 stackpanel

我想在可垂直滚动的ListView上放置一个水平可滚动的StackPanel,其中包含项目。父级是ListView,它的项目包含StackPanel。

问题: ListView垂直滚动。但水平StackPanels不会在ListView上水平滚动。为什么不?即使他们在ScrollView中。

如何使水平StackPanel在垂直ListView上水平滚动?

Here is an image illustrating it

代码示例:

<Grid x:Name="MainFragment" Background="White">
    <ListView ItemsSource="{Binding}" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" Margin="10,10,10,5">
        <ListView.ItemTemplate>
            <DataTemplate>
                <Grid Background="#FF94CF6C">
                    <StackPanel Margin="5,0,0,0">
                        <TextBlock Text="Badges:" Foreground="Black" FontWeight="Bold" Margin="0,5,0,0" />
                        <StackPanel Orientation="Horizontal" Height="18">
                            <Image Source="{Binding}" />
                            <Image Source="{Binding}" />
                            <Image Source="{Binding}" />
                            <Image Source="{Binding}" />
                            <Image Source="{Binding}" />
                            <Image Source="{Binding}" />
                            <Image Source="{Binding}" />
                            <Image Source="{Binding}" />
                            <Image Source="{Binding}" />
                            <Image Source="{Binding}" />
                            <Image Source="{Binding}" />
                        </StackPanel>
                    </StackPanel>
                </Grid>
            </DataTemplate>
        </ListView.ItemTemplate>
    </ListView>
</Grid>

0 个答案:

没有答案