如何在全景页面和新页面之间导航(非全景)

时间:2013-04-09 19:48:41

标签: c# windows-phone-7

所以我有listitems,当我点击一个项目时,我必须导航到一个新页面(非全景)。与标准数据绑定应用程序一样。我复制粘贴代码就像数据绑定应用程序一样,没有做我想做的事。

这是我的全景页面。

<controls:PanoramaItem x:Name="deeln" Header="Deelnemers" Style="{StaticResource subtitle}">
                <!--Double line list with image placeholder and text wrapping-->
                <ListBox Margin="12,0,-12,0" ItemsSource="{Binding ItemsDeelnemer}" x:Name="lbDeelnemer" SelectionChanged="lbDeelnemer_SelectionChanged">
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <ScrollViewer HorizontalScrollBarVisibility="Visible" VerticalScrollBarVisibility="Disabled">

                                <StackPanel Orientation="Horizontal" Margin="0,0,0,17">
                                        <TextBlock Foreground="Black" TextWrapping="Wrap" Text="{Binding LineNr}" Style="{StaticResource PhoneTextExtraLargeStyle}" FontSize="35" ></TextBlock>
                                    <StackPanel Width="430" Height="100">
                                        <TextBlock Foreground="Black" TextWrapping="Wrap" Text="{Binding LineNaamWielrenner1}" Style="{StaticResource PhoneTextExtraLargeStyle}" FontSize="35"></TextBlock>
                                        <TextBlock Foreground="Black" TextWrapping="Wrap" Text="{Binding LineNaamWielrenner2}" Style="{StaticResource PhoneTextExtraLargeStyle}" FontSize="35"></TextBlock>
                                    </StackPanel>
                                </StackPanel>

                            </ScrollViewer>
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>
            </controls:PanoramaItem>

以下是我的全景页面代码。

private void lbDeelnemer_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            #region go to specific deelnemerinfo screen

           // int indexer = lbDeelnemer.SelectedIndex;

            // If selected index is -1 (no selection) do nothing
            if (lbDeelnemer.SelectedIndex == -1)
                return;
            // Navigate to the new page                    
                NavigationService.Navigate(new Uri("/DeelnemerInfo.xaml", UriKind.Relative));
                //NavigationService.Navigate(new Uri("/DeelnemerInfo.xaml?selectedItem=" + lbDeelnemer.SelectedIndex, UriKind.Relative));
            // Reset selected index to -1 (no selection)
            lbDeelnemer.SelectedIndex = -1;

            #endregion
        }

注意:/DeelnemerInfo.xaml是新页面(非全景页面),只是一个基本的纵向页面。 救救我!

1 个答案:

答案 0 :(得分:0)

从列表中删除ScrollViewer。

ScrollViewer捕获点击/点击并且不让ListBox获取它们(因此ListBox不会获取事件)。

当您在ListBox中有一个按钮时,您可以看到同样的事情 - 当点击按钮时,选择不会改变。