Take the 2-minute tour ×

I don't know if this is a general web-services issue or just my specific scenario, which is a WPF application with a DispatcherTimer calling a web-service method. Whenever the timer is called, the mouse cursor automatically changes to an hourglass cursor.

The processing of the call is very short and happens every 3 seconds, so the user experience is that every 3 seconds the mouse filckers as an hourglass for a split-second and then goes back to the normal cursor representation.

How can I avoid this inconvenience?


share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

Is your entire app going unresponsive whenever the timer fires as well, or is the whole process too fast to notice?

My assumption is that you may be invoking code synchronously on your DispatcherTimer, which could cause brief moments of unresponsiveness (and perhaps the hourglass). To get around this, ensure that your Dispatcher's Tick event is async code.

Here's a simple little example that, every 3 seconds, performs a second of fake work and then updates the GUI:

public partial class MainWindow : Window
    private static int foo = 0;

    public MainWindow()

        DispatcherTimer timer = new DispatcherTimer();
        timer.Interval = TimeSpan.FromMilliseconds(3000);
        timer.Tick += new EventHandler(delegate(object o, EventArgs args)
            StatusBox.Text = "Incrementing";

            ThreadStart start = delegate()
                // Simulate work

                // Update gui
                this.Dispatcher.BeginInvoke(new Action(delegate
                    CountingBox.Text = (foo++).ToString();
                    StatusBox.Text = "Waiting";

            new Thread(start).Start();                


(There are other methods to accomplish the same goals, this one was simple to rattle off. See the guidance here for a lot more information: http://msdn.microsoft.com/en-us/magazine/cc163328.aspx)

share|improve this answer
Excellent!! Worked like a charm - Thanks! (sorry I can't vote for your answer but it hit the spot :) –  AVIDeveloper Jun 10 '10 at 10:43
BTW, you were right - I DID call the web-service synchronously and I also think this is the source of the hourglass blinks. Thanks again! –  AVIDeveloper Jun 10 '10 at 10:45
Glad I could help. =) –  Andrew Anderson Jun 10 '10 at 11:15
add comment

Your Answer


