简体   繁体   English

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

[英]WP7 - Is it Possible to change the Panorama from horizontal to Vertical scroll?

In my app now i am using Panorama to show many items. 现在在我的应用程序中,我正在使用Panorama来显示许多项目。 It showing horizontal scroll. 它显示水平滚动。 But i want to show in vertical. 但我想垂直展示。 It is possible to change the scrolling from horizontal to vertical? 可以将滚动从水平更改为垂直吗? I have try like this. 我有这样的尝试。

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

                </StackPanel>
            </ItemsPanelTemplate>
        </controls:Panorama.ItemsPanel>

But it return error at execution time. 但是它在执行时返回错误。 Is there anyway to change change the Panorama from horizontal to Vertical scroll? 是否有任何要更改的全景图从水平滚动到垂直滚动?

My try using Listbox. 我尝试使用列表框。

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

I have try Scroll Viewer also. 我也尝试过Scroll Viewer。 It is also not working. 它也不起作用。

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

No ! 不行 there is no way to scroll it vertically. 没有办法垂直滚动它。 But you can use listbox or you can make your own control ie custom control. 但是您可以使用列表框,也可以创建自己的控件,即自定义控件。

Your second ListBox has the Grid.Row set to 1. It should be 0, from what I can tell. 第二个ListBox的Grid.Row设置为1。据我所知,它应该为0。 Your Scrollviewer is in Grid.Row="0" by default, meaning your stackpanel is also in 0, meaning your first listbox is in 0...you get the picture. 默认情况下,您的Scrollviewer位于Grid.Row =“ 0”中,这意味着您的堆栈面板也位于0中,这意味着您的第一个列表框位于0中……您得到图片。 :) :)

Sorry if I'm incorrect. 对不起,如果我不正确。 :( :(

edit: Also, your listboxes seem to be exactly identical, aside from the name you assign to each one. 编辑:此外,除了为每个列表框分配的名称以外,您的列表框似乎完全相同。 I'm not sure what you're trying to accomplish? 我不确定您要完成什么? Why would you need two separate listboxes to show all the same data? 为什么需要两个单独的列表框来显示所有相同的数据?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM