c#换页没有换回来

c#换页没有换回来,c#,C#,当我点击下一页的图标时,它的工作正常,但当我点击上一页的图标时,继续更改下一页。我想我需要使用SelectedId函数 这是我正在使用的图标的名称:grdSpecialPageExerciseIndex 代码: private void grdSpecialPageExerciseIndex_点击(对象发送方,点击RoutedEventArgs e) { 开关(专用LbtnId) { 案例0: if(specialBTNIDEX

当我点击下一页的图标时,它的工作正常,但当我点击上一页的图标时,继续更改下一页。我想我需要使用SelectedId函数

这是我正在使用的图标的名称:grdSpecialPageExerciseIndex

代码:

private void grdSpecialPageExerciseIndex_点击(对象发送方,点击RoutedEventArgs e)
{
开关(专用LbtnId)
{
案例0:
if(specialBTNIDEX
我想你有点困惑。如果您正在路由事件,请单击同一方法上的“下一步”和“上一步”按钮,您将具有相同的执行/逻辑。在这种情况下,specialbtnId如何工作?如果它增加,此方法将始终转到下一页

我会建议你去看一个或得到一个导航逻辑

或者简单地使用ContentControl。在ContentControl中,您只需将内容添加到页面或UserControl中,就可以在每次添加内容时重写内容。但在这里,您没有反向导航。你可能必须自己做

 private void grdSpecialPageExerciseIndex_Tapped(object sender, TappedRoutedEventArgs e)
    {
      switch (specialbtnId)
        {
            case 0:
                if (specialbtnIndex < lstCurrentPageLeftButton1Excersices.Count() - 1)
                {
                    specialbtnIndex++;
                    LoadSpecialPagesBookExcersices(lstCurrentPageLeftButton1Excersices.ElementAt(specialbtnIndex));
                    txbSpecialPageExerciseNumber.Text = (specialbtnIndex + 1).ToString();
                    txbSpecialPageExerciseNumberCount.Text = lstCurrentPageLeftButton1Excersices.Count().ToString();
                    // btn1SpecialPages.DataContext = lstCurrentPageLeftButton1Excersices.ElementAt(0);
                }
                break;

            case 1:
                if (specialbtnIndex < lstCurrentPageLeftButton2Excersices.Count() - 1)
                {
                    ;
                    specialbtnIndex++;
                    LoadSpecialPagesBookExcersices(lstCurrentPageLeftButton2Excersices.ElementAt(specialbtnIndex));
                    txbSpecialPageExerciseNumber.Text = (specialbtnIndex + 1).ToString();
                    txbSpecialPageExerciseNumberCount.Text = lstCurrentPageLeftButton2Excersices.Count().ToString();
                    // btn1SpecialPages.DataContext = lstCurrentPageLeftButton1Excersices.ElementAt(0);
                }
                break;

            case 2:
                if (specialbtnIndex < lstCurrentPageLeftButton3Excersices.Count() - 1)
                {
                    specialbtnIndex++;
                    LoadSpecialPagesBookExcersices(lstCurrentPageLeftButton3Excersices.ElementAt(specialbtnIndex));
                    txbSpecialPageExerciseNumber.Text = (specialbtnIndex + 1).ToString();
                    txbSpecialPageExerciseNumberCount.Text = lstCurrentPageLeftButton3Excersices.Count().ToString();
                    //btn1SpecialPages.DataContext = lstCurrentPageLeftButton1Excersices.ElementAt(0);
                }
                break; 
    }

}