WPF Show wait cursor before application fully loads

Posted by e28Makaveli on Stack Overflow See other posts from Stack Overflow or by e28Makaveli
Published on 2010-05-31T21:36:04Z Indexed on 2010/05/31 21:43 UTC
Read the original article Hit count: 263

Filed under:
|
|

I want to show the wait cursor before my WPF application, composed using CAL, fully loads.

In the constructor of the main window, I have the following code:

 public MainWindow([Dependency] IUnityContainer container)
        {                                                            

            InitializeComponent();

            Cursor = System.Windows.Input.Cursors.Wait;
            Mouse.OverrideCursor = System.Windows.Input.Cursors.Wait;
            ForceCursor = true;

            //this.Cursor = System.Windows.Input.Cursors.AppStarting;

            // event subscriptions            

            PresenterBase.EventAggregate.GetEvent<ModulesLoadedEvent>().Subscribe(OnModulesLoaded);                                                               
        }

After all modules have been loaded, the following handler is invoked:

 private void OnModulesLoaded(EventArgs e)
        {
            allModulesLoaded = true;
            Mouse.OverrideCursor = null;
            Cursor = System.Windows.Input.Cursors.Arrow;

        }    

Problem is, I do not see this wait cursor. What I am missing here? FWIW, I got a hint from this post

http://stackoverflow.com/questions/2078766/showing-the-wait-cursor

TIA.

© Stack Overflow or respective owner

Related posts about wpf

Related posts about cursor