WPF C# InputBox

前端 未结 6 856
予麋鹿
予麋鹿 2020-12-02 17:57

I am building a WPF application using C#. I want to pop out a dialog box to prompt the user to enter his/her name. After that I will keep track of the name and save some dat

6条回答
  •  抹茶落季
    2020-12-02 18:04

    Just create another Window class in your Visual Studio-project, which holds the username in a public property. Then create an instance of this window somewhere in your main window, and Show it using the ShowDialog method. This blocks until your "dialog" window is closed. Then you can get the username from the public property and do whatever you want with it.

提交回复
热议问题