How do I show a MessaegBox after my main Window and it’s contents are all loaded and visible?

Platform: WPF| Category: Window

Use the Dispatcher object to make your method run after all the ‘background’ operations are completed, as follows:

public Window1()
        {
            InitializeComponent();
            this.Dispatcher.BeginInvoke(DispatcherPriority.Background, new SomeMethodDelegate(DoSomething));
        }

        private delegate void SomeMethodDelegate();

        private void DoSomething()
        {
            MessageBox.Show('Everything is loaded.');
        }

Share with

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.