1

How to display a message box inside WPF windows? Below is the code I have used to display message box but the message box always displays at the center of the screen instead of inside the WPF form. Is this possible with MessageBox? An alternate way is to use my own custom form to display the message but if possible I would like to use MessageBox. Thanks!

 private void Button1_Click(object sender, RoutedEventArgs e)
        {
            MessageBox.Show(this,"The record is saved successfully", "Save", MessageBoxButton.OK, MessageBoxImage.Information);
        }
Simant
  • 3,142
  • 4
  • 32
  • 61
  • 1
    Depends what you mean with inside. [This](https://learn.microsoft.com/en-us/dotnet/api/system.windows.messagebox.show?view=netframework-4.7.2#System_Windows_MessageBox_Show_System_Windows_Window_System_String_System_String_System_Windows_MessageBoxButton_System_Windows_MessageBoxImage_System_Windows_MessageBoxResult_System_Windows_MessageBoxOptions_) will show the message box in front of the specified Window – Nawed Nabi Zada Dec 07 '18 at 13:13
  • https://www.daimto.com/wpf-center-message-box-on-window/ – mm8 Dec 07 '18 at 13:34
  • Possible duplicate of [How to get MessageBox.Show() to pop up in the middle of my WPF application?](https://stackoverflow.com/questions/564710/how-to-get-messagebox-show-to-pop-up-in-the-middle-of-my-wpf-application) – StayOnTarget Apr 30 '19 at 15:07

0 Answers0