简体   繁体   中英

How to navigate between panorama page and a new page (non panorama)

So i've got listitems, when i click on an item, i have to navigate to a new page (non panorama). Like the standard databound application. I have copy paste the code like a databound application, doesn't do what I want.

Here is my xaml of panorama page.

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

Here is my code of the panorama page.

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
        }

Note: /DeelnemerInfo.xaml is the new page (non panorama page) just a basic portrait page. Help me!

Remove the ScrollViewer from your list.

The ScrollViewer captures the taps/clicks and doesn't let the ListBox get them (and thus the ListBox does not get the event).

You can see the same thing happening when you have a button inside a ListBox - Selection will not change when the button is tapped.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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