The show() method in my wpf does not work

Asked

Viewed 61 times

1

I made a tiny desktop application using wpf. I have a very simple login screen and this screen should call the main screen. I did so:

Menu menu = new Menu();
menu.Show();

You are making a mistake in the show, saying that you are not recognized. The namespace System.Windows is added to the project.

  • 1

    What’s the mistake exactly?

  • @LINQ, says Menu does not contain a definition for Show(). Do I need to add some Assembly?

  • 1

    Which menu is namespace? If from System.Windows.Controls this method there is no and it wouldn’t even make sense to exist.

  • @LINQ, Menu is a class I created and it’s her I want to show.

  • I think it was the name of the Menu class that I created and coincided with some reserved name. I created a new class with another name and it worked.

1 answer

1


The problem is that the class Menu of its code refers to System.Windows.Controls.Menu.

Write the full name of your class Menu or define a alias for your namespace (or System.Windows.Controls). The important thing is to remove ambiguity.

var menu = new SeuNamespace.Menu();
menu.Show();

Browser other questions tagged

You are not signed in. Login or sign up in order to post.