I was pulling out my hair trying to figure out why the normal Dispatcher.Invoke command did not work for redrawing my window, but now I the issue seems to be related to the content being disabled. I'm using the Dotnet 4.0 full framework.
If i use
private void DoSomething()
{
HandleBusyEnableDisable(false);
DoSomethingThatKeepsItBusy();
HandleBusyEnableDisable(true);
}
private void HandleBusyEnableDisable(bool enabling)
{
Cursor = enabling ? Cursors.Arrow : Cursors.Wait;
CanvasFunctions.IsEnabled = enabling;
CanvasRight.IsEnabled = enabling;
CanvasRight.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Render, EmptyDelegate);
I see the cursor change but the content does not look disabled. If i add
CanvasRight.Opacity = enabling ? 1 : .5;
then i think it works, sometimes. Is there something else i can do?
The task that's running is validating user entered data, so its much easier to run on the GUI thread. This shouldn't be that hard.