簡體   English   中英

如何在全景頁面和新頁面(非全景)之間導航

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

所以我有列表項,當我單擊一個項目時,我必須導航到一個新頁面(非全景)。 像標准的數據綁定應用程序一樣。 我已經復制粘貼了代碼,就像一個數據綁定應用程序一樣,沒有做我想要的事情。

這是我的全景頁面xaml。

<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是新頁面(非全景頁面),只是基本的縱向頁面。 幫我!

從列表中刪除ScrollViewer。

ScrollViewer捕獲點擊/單擊,並且不讓ListBox來獲取它們(因此ListBox不會獲取事件)。

當列表框內有一個按鈕時,您會看到同樣的事情-點擊該按鈕時,選擇不會改變。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM