[c#] WPF popup window

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 would be my preference. Using a MessageBox is not a solution for me as it does not allow the user to change the title of buttons.

This question is related to c# wpf

The answer is


Simply show a new window with two buttons. Add property to contain user result.


In WPF there is a control named Popup.

Popup myPopup = new Popup();
//(...)
myPopup.IsOpen = true;

XAML

<Popup Name="myPopup">
      <TextBlock Name="myPopupText" 
                 Background="LightBlue" 
                 Foreground="Blue">
        Popup Text
      </TextBlock>
</Popup>

c#

    Popup codePopup = new Popup();
    TextBlock popupText = new TextBlock();
    popupText.Text = "Popup Text";
    popupText.Background = Brushes.LightBlue;
    popupText.Foreground = Brushes.Blue;
    codePopup.Child = popupText;

you can find more details about the Popup Control from MSDN documentation.

MSDN documentation on Popup control