WPF popup window

前端 未结 4 871
时光取名叫无心
时光取名叫无心 2021-01-01 10:19

I would like to let the user choose their options after a button is clicked. For example, showing two buttons, \"Restart Now\" and \"Restart Later\" in a modal popup window

4条回答
  •  Happy的楠姐
    2021-01-01 10:46

    You need to create a new Window class. You can design that then any way you want. You can create and show a window modally like this:

    MyWindow popup = new MyWindow();
    popup.ShowDialog();
    

    You can add a custom property for your result value, or if you only have two possible results ( + possibly undeterminate, which would be null), you can set the window's DialogResult property before closing it and then check for it (it is the value returned by ShowDialog()).

提交回复
热议问题