I was pulling my hair out trying to figure out why the normal Dispatcher.Invoke command doesnโt work to redraw my window, but now I think the problem is with the disabled content. I use the full Dotnet 4.0 infrastructure.
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 a cursor change, but the content does not seem to be disabled. If I add
CanvasRight.Opacity = enabling ? 1 : .5;
then I think it works, sometimes. Is there anything else I can do?
The performed task checks the data entered by the user, so it is much easier to run in the GUI stream. It shouldn't be that hard.