C# 如何在全景页面和新页面(非全景)之间导航
所以我有listitems,当我点击一个项目时,我必须导航到一个新页面(非全景)。就像标准的数据库应用程序一样。我像复制粘贴数据绑定应用程序一样复制粘贴代码,但不执行我想要的操作 这是我的全景页面的xamlC# 如何在全景页面和新页面(非全景)之间导航,c#,windows-phone-7,C#,Windows Phone 7,所以我有listitems,当我点击一个项目时,我必须导航到一个新页面(非全景)。就像标准的数据库应用程序一样。我像复制粘贴数据绑定应用程序一样复制粘贴代码,但不执行我想要的操作 这是我的全景页面的xaml <controls:PanoramaItem x:Name="deeln" Header="Deelnemers" Style="{StaticResource subtitle}"> <!--Double line list with im
<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不会获取事件)
当您在列表框中有一个按钮时,您可以看到同样的情况发生-点击按钮时选择不会更改。对不起,您想将参数传递到新页面,但我不明白问题是什么?如果您在lbDeelnemer\u SelectionChanged中设置断点,是否会引发该问题?当您更改列表框中的选择时,实际会发生什么情况?不,它没有引发,我已经检查过了,但不知道如何修复..@Alexandr我只是想导航,没有参数。所以一般来说,我的问题是,如果我单击列表项,它不会响应我的选择更改,我得到的索引总是-1。我刚刚修复了它,它可以工作,但我知道我不能滚动,因为scrollviewer已经不存在了。我该如何解决这个问题@Shahar PrishYou想要在每个项目中导航吗?所以我有24个列表项目,没有。我删除了scrollviewer以解决我之前的问题。现在我希望仍然能够垂直滚动。但是我可以添加一个scrollviewer,因为我以前的问题会回来。你知道吗@沙哈尔·普里什诺普。要滚动整个列表框,还是滚动列表中的每个项目?滚动列表中的每个项目