在页面之间导航有问题

时间:2013-10-23 06:16:58

标签: c# windows-phone-7

我为列表中的列表项添加了一个tap事件处理程序,我的xaml代码如下所示

<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
        <ListBox x:Name="List" HorizontalAlignment="Left" Height="612" Margin="6,7,0,0" VerticalAlignment="Top" Width="443" >
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <StackPanel Orientation="Horizontal" Width="400" Height="50" Tap="StackPanel_Tap_1" >
                        <TextBlock x:Name="tbName" Width="300" Height="44" FontSize="22" FontWeight="Bold" Text="{Binding Name}" />
                        <TextBlock x:Name="tbEmail" Width="100" Height="44" FontSize="22" Text="{Binding Amount}"/>
                    </StackPanel>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
    </Grid>

我的c#代码是,

private void StackPanel_Tap_1(object sender, GestureEventArgs e)
    {
        NavigationService.Navigate(new Uri("/Page2.xaml", UriKind.Relative));
    }

现在,当我点击列表时,我的导航失败并且函数自动执行App.xaml.cs中的以下内置函数

 private void RootFrame_NavigationFailed(object sender, NavigationFailedEventArgs e)
    {
        if (System.Diagnostics.Debugger.IsAttached)
        {
            // A navigation has failed; break into the debugger
            System.Diagnostics.Debugger.Break();
        }
    }

有什么问题?我该如何纠正它?

0 个答案:

没有答案