Reputation: 303
I'm using WPF. I have a window named NewWindow.xaml
, and I want it to open when the user presses a button in a separate Window. This is what I have:
private void Button(object sender, CanExecuteRoutedEventArgs e)
{
e.CanExecute = true;
NewWindow.Show();
}
Although, it gives me an error and says I can simplify it. Then, it doesn't do anything. What can I do?
Upvotes: 1
Views: 92
Reputation: 231
Try this instead of your code in that method:
NewWindow yourInstanceOfTheNewWindow = new NewWindow();
yourInstanceOfTheNewWindow.Show();
Click here and here for more Information.
Upvotes: 2