2013-04-09 20 views
1

所以我有listitems,當我點擊一個項目,我必須導航到一個新的頁面(非全景圖)。像標準的數據綁定應用程序一樣。我有複製粘貼代碼像一個數據綁定應用程序,不做我想要的。如何瀏覽全景圖頁面和新頁面(非全景圖)

這是我的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是新頁面(非全景頁面),只是一個基本的人像頁面。 幫幫我!

+0

你想傳遞參數到一個新的頁面,我很抱歉,但我不明白是什麼問題? – Alexandr 2013-04-09 19:54:39

+1

如果你在lbDeelnemer_SelectionChanged中放置了一個斷點,它會被提升嗎?當您更改列表框中的選擇時實際發生了什麼? – 2013-04-09 20:09:22

+0

沒有它沒有提出,我已經檢查,但不知道如何修復.. – 2013-04-10 10:25:43

回答

0

從列表中刪除ScrollViewer。

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

當你在ListBox中有一個按鈕時,你會看到同樣的事情發生 - 當按鈕被點擊時,選擇不會改變。

+0

我只是修復了它,它的工作原理,但知道我不能滾動,因爲scrollviewer不見了。我如何解決這個問題? @Shahar Prish – 2013-04-10 11:56:39

+0

你想在每個項目內導航? – 2013-04-10 12:03:31

+0

所以我有24個listitems,沒有我刪除scrollviewer爲我以前的問題。現在我想仍然能夠垂直滾動。但是我可以添加一個scrollviewer,因爲我以前的問題會回來。你知道它知道嗎? @Shahar Prish – 2013-04-10 12:08:12

相關問題