1

i really tried searching this but didnt find anything.

I have WPF Window, inside this i got Frame in which i put WPF pages.

I tried to make "wizard" in which i go through 4 pages by clicking next in previous page, or back to get to exit or the page it was previously.
But the problem is that in debug i can see that he is going through code i want but it seems that the code is doing nothing.

there is my parent class in which is frame, and 2 objects for 2 pages and method that is changing current frame content or should close entire window.

public void ManagePages(int _page)
{
    switch (_page)
    {
        case 0:
            pageFrame.Content = null;
            _instance = null;
            this.Close(); 
            break;
        case 1:
            pageFrame.Content = page1;
            break;
        case 2:
            pageFrame.Content = page2;
            break;
        case 3:
            //   pageFrame.Content = page3;
            break;
        case 4:
            //   pageFrame.Content = page4;
            break;
    }
}

and the page buttons which go next or back ( exit )

private void backBtn_Click(object sender, RoutedEventArgs e)
{
    MakeBudgetWindow.Instance.ManagePages(0);
}

private void forwardBtn_Click(object sender, RoutedEventArgs e)
{
    if(budgetBalance.Text != "" && budgetNameText.Text != "")
    {
        MakeBudgetWindow.Instance._budgetstack.Push(budgetNameText);
        MakeBudgetWindow.Instance._budgetstack.Push(budgetBalance);
        MakeBudgetWindow.Instance.ManagePages(2);
    }
    else
    {
        MessageBox.Show("Fields cant be empty!");
    }
}

What's wrong here, why window doesn't close on this.Close() or page is not going forward?
Is any possibility to do it this way or should i make buttons insinde Window not inside pages?

VMAtm
  • 27,943
  • 17
  • 79
  • 125
Zeronader
  • 95
  • 7
  • Maybe you should check out this [question](http://stackoverflow.com/questions/287193/is-there-a-wizard-control-in-wpf). – juharr Mar 23 '15 at 11:38
  • Thanks, thats nice example, but still don't know why does my code not working corectly. – Zeronader Mar 23 '15 at 12:21

0 Answers0