C# WP7-是否可以将全景从水平滚动更改为垂直滚动?

C# WP7-是否可以将全景从水平滚动更改为垂直滚动?,c#,windows-phone-7,panorama-control,C#,Windows Phone 7,Panorama Control,在我的应用程序中,我现在使用全景来显示许多项目。它显示水平滚动。但我想垂直展示。是否可以将滚动从水平更改为垂直? 我试过这样做 <controls:Panorama.ItemsPanel> <ItemsPanelTemplate> <StackPanel Orientation="Vertical"> </StackPanel>

在我的应用程序中,我现在使用全景来显示许多项目。它显示水平滚动。但我想垂直展示。是否可以将滚动从水平更改为垂直? 我试过这样做

        <controls:Panorama.ItemsPanel>
            <ItemsPanelTemplate>
                <StackPanel Orientation="Vertical">

                </StackPanel>
            </ItemsPanelTemplate>
        </controls:Panorama.ItemsPanel>
但它在执行时返回错误。 是否仍然可以将全景从水平滚动更改为垂直滚动

我尝试使用列表框

 <Grid x:Name="LayoutRoot" Background="Transparent">
    <Grid.RowDefinitions>
        <RowDefinition Height="Auto"/>
        <RowDefinition Height="*"/>
    </Grid.RowDefinitions>

    <Grid x:Name="testUIContainer" Margin="2,0,2,0">
        <ListBox>
            <StackPanel>
                <!--<Rectangle  Height="50" Margin="0,0,0,0" Name="Header" Stroke="Black" StrokeThickness="1" Width="480" Grid.ColumnSpan="2" Fill="#FF01A1DB" />-->
                <ListBox Grid.Row="0" ItemsSource="{Binding StudentDetails,Mode=TwoWay}" Margin="0,0,0,0" Name="listBox1" Width="476" BorderBrush="#00410D0D">
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <Border BorderBrush="Gray" Padding="5" BorderThickness="1">
                                <StackPanel Orientation="Horizontal" >
                                    <Border BorderBrush="Wheat" BorderThickness="1">
                                        <Image  Name="ListPersonImage" Source="{Binding PersonImage}" Height="100" Width="100" Stretch="Uniform" Margin="10,0,0,0"/>
                                    </Border>
                                    <TextBlock Text="{Binding FirstName}" Name="firstName" Width="200" Foreground="White" Margin="10,10,0,0" FontWeight="SemiBold" FontSize="22"  />
                                    <TextBlock Text="{Binding LastName}" Name="lastName" Width="200" Foreground="White" Margin="-200,50,0,0" FontWeight="SemiBold" FontSize="22"  />
                                    <TextBlock Text="{Binding Age}" Name="age" Width="200" Foreground="White" Margin="10,10,0,0" FontWeight="SemiBold" FontSize="22"  />
                                </StackPanel>
                            </Border>
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>

                <ListBox Grid.Row="1" ItemsSource="{Binding StudentDetails,Mode=TwoWay}" HorizontalAlignment="Left" Margin="0,0,0,0" Name="listBoxes1" Width="476" BorderBrush="#00410D0D">
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <Border BorderBrush="Gray" Padding="5" BorderThickness="1">
                                <StackPanel Orientation="Horizontal" >
                                    <Border BorderBrush="Wheat" BorderThickness="1">
                                        <Image  Name="ListPersonImage" Source="{Binding PersonImage}" Height="100" Width="100" Stretch="Uniform" Margin="10,0,0,0"/>
                                    </Border>
                                    <TextBlock Text="{Binding FirstName}" Name="firstName" Width="200" Foreground="White" Margin="10,10,0,0" FontWeight="SemiBold" FontSize="22"  />
                                    <TextBlock Text="{Binding LastName}" Name="lastName" Width="200" Foreground="White" Margin="-200,50,0,0" FontWeight="SemiBold" FontSize="22"  />
                                    <TextBlock Text="{Binding Age}" Name="age" Width="200" Foreground="White" Margin="10,10,0,0" FontWeight="SemiBold" FontSize="22"  />
                                </StackPanel>
                            </Border>
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>
            </StackPanel>
        </ListBox>
    </Grid>
</Grid>
我也尝试了滚动查看器。它也不起作用

 <Grid x:Name="LayoutRoot" Background="Transparent">
    <Grid.RowDefinitions>
        <RowDefinition Height="Auto"/>
        <RowDefinition Height="*"/>
    </Grid.RowDefinitions>

    <Grid x:Name="testUIContainer" Margin="2,0,2,0">
        <ScrollViewer VerticalScrollBarVisibility="Visible">
            <ScrollViewer.Content>
                <ListBox>
                    <StackPanel>
                        <!--<Rectangle  Height="50" Margin="0,0,0,0" Name="Header" Stroke="Black" StrokeThickness="1" Width="480" Grid.ColumnSpan="2" Fill="#FF01A1DB" />-->
                        <ListBox Grid.Row="0" ItemsSource="{Binding StudentDetails,Mode=TwoWay}" Margin="0,0,0,0" Name="listBox1" Width="476" BorderBrush="#00410D0D">
                            <ListBox.ItemTemplate>
                                <DataTemplate>
                                    <Border BorderBrush="Gray" Padding="5" BorderThickness="1">
                                        <StackPanel Orientation="Horizontal" >
                                            <Border BorderBrush="Wheat" BorderThickness="1">
                                                <Image  Name="ListPersonImage" Source="{Binding PersonImage}" Height="100" Width="100" Stretch="Uniform" Margin="10,0,0,0"/>
                                            </Border>
                                            <TextBlock Text="{Binding FirstName}" Name="firstName" Width="200" Foreground="White" Margin="10,10,0,0" FontWeight="SemiBold" FontSize="22"  />
                                            <TextBlock Text="{Binding LastName}" Name="lastName" Width="200" Foreground="White" Margin="-200,50,0,0" FontWeight="SemiBold" FontSize="22"  />
                                            <TextBlock Text="{Binding Age}" Name="age" Width="200" Foreground="White" Margin="10,10,0,0" FontWeight="SemiBold" FontSize="22"  />
                                        </StackPanel>
                                    </Border>
                                </DataTemplate>
                            </ListBox.ItemTemplate>
                        </ListBox>

                        <ListBox Grid.Row="1" ItemsSource="{Binding StudentDetails,Mode=TwoWay}" HorizontalAlignment="Left" Margin="0,0,0,0" Name="listBoxes1" Width="476" BorderBrush="#00410D0D">
                            <ListBox.ItemTemplate>
                                <DataTemplate>
                                    <Border BorderBrush="Gray" Padding="5" BorderThickness="1">
                                        <StackPanel Orientation="Horizontal" >
                                            <Border BorderBrush="Wheat" BorderThickness="1">
                                                <Image  Name="ListPersonImage" Source="{Binding PersonImage}" Height="100" Width="100" Stretch="Uniform" Margin="10,0,0,0"/>
                                            </Border>
                                            <TextBlock Text="{Binding FirstName}" Name="firstName" Width="200" Foreground="White" Margin="10,10,0,0" FontWeight="SemiBold" FontSize="22"  />
                                            <TextBlock Text="{Binding LastName}" Name="lastName" Width="200" Foreground="White" Margin="-200,50,0,0" FontWeight="SemiBold" FontSize="22"  />
                                            <TextBlock Text="{Binding Age}" Name="age" Width="200" Foreground="White" Margin="10,10,0,0" FontWeight="SemiBold" FontSize="22"  />
                                        </StackPanel>
                                    </Border>
                                </DataTemplate>
                            </ListBox.ItemTemplate>
                        </ListBox>
                    </StackPanel>
                </ListBox>
            </ScrollViewer.Content>
        </ScrollViewer>
    </Grid>
</Grid>

不!无法垂直滚动它。但您可以使用listbox,也可以创建自己的控件,即自定义控件

第二个列表框的Grid.Row设置为1。据我所知,应该是0。您的Scrollviewer位于网格中。默认情况下,Row=0,这意味着您的stackpanel也位于0,这意味着您的第一个列表框位于0…您将看到图片:

对不起,如果我错了


编辑:此外,除了为每个列表框指定的名称外,您的列表框似乎完全相同。我不知道你想做什么?为什么需要两个单独的列表框来显示所有相同的数据?

Hi@HmXa。。谢谢你的回复。“枢轴控制”呢。在“枢轴控制”中是否可能?实际上,我的要求是,在Android Play store中,当我们选择一个应用程序时,它将移动到一个页面。在该页面中,我们可以看到评论、屏幕截图、类似的应用程序等,就像我正在尝试做的那样。我想添加这样的项目,我想在垂直滚动。可能吗?嗨!不幸的是,无法垂直滚动全景和轴控制。但您可以将列表框放在全景和轴控件中。@user2845346:据我所知,您可以自己制作。示例:您可以在主页上使用listbox。在列表框中放置一个stackpanel。将listbox放入stackpanel并绑定一些图像。并根据您的意愿将其设置为垂直或水平滚动。Hi@HmXa。我已经按照你的提示附上了我的代码。但它不起作用。我看不到第二个列表框。因为第一个列表框有10个以上的列表项。我的代码是正确的,或者我必须在哪里进行更正?第二个列表框是否未显示?我认为您应该将第一个列表框的高度设置为“自动”。请检查一下并告诉我。谢谢@user3007447。。在我的应用程序中,我试图实现一个类似Android Play Store页面的页面。在Android play store中,当用户单击一个应用程序时,页面将导航到另一个页面。在该页面中,我们可以看到评论、屏幕截图、类似的应用程序等。用户将垂直滚动查看所有数据。像那样,只有我在努力。但我不能做到这一点。我尝试过全景、透视页面。在这几页中,我只能水平滚动。好的,这是有意义的。不幸的是,我不知道该怎么做,也不知道这是否可能。很抱歉