Question MessageBox : MessageBox « Windows Presentation Foundation « C# / CSharp Tutorial






using System;
using System.Windows;
using System.Windows.Input;

    class MainClass : Application
    {
        [STAThread]
        public static void Main()
        {
            MainClass app = new MainClass();
            app.Run();
        }
        protected override void OnStartup(StartupEventArgs args)
        {
            base.OnStartup(args);

            Window win = new Window();
            win.Title = "title";
            win.Show();
        }
        protected override void OnSessionEnding(SessionEndingCancelEventArgs args)
        {
            base.OnSessionEnding(args);

            MessageBoxResult result = MessageBox.Show("save?",
                                MainWindow.Title, MessageBoxButton.YesNoCancel, 
                                MessageBoxImage.Question, MessageBoxResult.Yes);

            args.Cancel = (result == MessageBoxResult.Cancel);
        }
    }








24.67.MessageBox
24.67.1.Message Only MessageBoxMessage Only MessageBox
24.67.2.MessageBox with Message and HeaderMessageBox with Message and Header
24.67.3.Set Message, Header, and Button for MessageBoxSet Message, Header, and Button for MessageBox
24.67.4.Customize Message, Header, Button, and Image for MessageBoxCustomize Message, Header, Button, and Image for MessageBox
24.67.5.Display a message box and get the message box return value.Display a message box and get the message box return value.
24.67.6.Display information with WPF MessageBox
24.67.7.WPF message box
24.67.8.Question MessageBox