1

I'm trying to create a "Guide" app for a videogame. I want a button to clear everything in the window and show something else instead of creating another window. I've been using the code:

Window1 w1 = new Window1(); w1.Show(); this.Close(); 

Instead of this method, which closes the current window and opens a new one, is there a way to clear everything in the window and pop up other information?

9
  • 1
    You mean like a "Wizard" kind of thing? See this answer - is that what you mean? Commented May 6, 2020 at 12:40
  • Here's the example: the user starts the app. They are then prompted to choose a category of information and when they choose one they get that information without opening a new window. What I want is for the Main Window to erase everything it has and replace its information with other information. Commented May 6, 2020 at 12:42
  • Or just replace the current Window's Content. Commented May 6, 2020 at 12:43
  • Exactly! Is there a way to use a button in a way that replaces the main window with another one without opening a new tab? Commented May 6, 2020 at 12:44
  • 1
    Thanks, Fildor, that was really helpful! Don't worry about the fun aspect of it, I need some of it or else it's going to be a pain to learn programming! What I discovered by doing some research on YouTube is that I can achieve what I want with "Views" so I just have to learn how to let the user switch those and I'll be set :) Commented May 6, 2020 at 13:05

1 Answer 1

1

You could create a Frame in your MainWindow and display different pages.

Xaml Frame:

<Frame x:Name="MainFrame" NavigationUIVisibility="Hidden" /> 

After that you create a new Page-Control and navigate to it

var page = new CustomerPage(); MainFrame.Navigate(page); 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.