This is a .Net 4.0 / WPF question.
I'm having a problem while drawing onto a Canvas an image composed of around 18,000 dynamically generated Visuals.
The Render() function caller overrides the mouse cursor withing the following logic:
"Mouse.OverrideCursor = null" is called and put into effect as expected, but the .Net framework will still have to internally call layout render operations to finally display the image on the canvas. This introduces a small period in which the image is not being displayed, but the cursor has already been reset.Code:try { Mouse.OverrideCursor = Cursors.Wait; // ... map2D.Render(Map); } catch (CorruptMapFileException) { //... } finally { Mouse.OverrideCursor = null; }
I don't want to listen to layout events simply for the sake of resetting the mouse cursor. I will, if I must. But is there a better way to deal with the asynchronous nature of the .Net layout rendering subsystem for this particular purpose?