I have a ProgressBar and a ProgressRing whose "Hidden" property is bound to an exported public "Discovering" property. Unhiding them is not a problem. But when I set the property to re-hide them, it takes a quite long time for the binding to take effect. The latency time is variable and can be as long as a minute. Even setting the "Display When Stopped" has no effect.
I've attached a test project and in it, I have a test Label which is bound to the same property and it does not exhibit the same latency problem.
Is this a known issue and if so, will it be fixed and is there a work-around?
Thanks
Posts
This is not a Xamarin.Mac bug.
In your example, you have this:
Note that you are setting Discovering on the timer thread. This means you are setting WillChangeValue / DidChangeValue on the timer thread.
This is bad. You should not do anything UI related on the non-UI thread unless you clear it by the documentation (https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/Multithreading/ThreadSafetySummary/ThreadSafetySummary.html).
Moving that into the BeginInvokeOnMainThread call made things work for me. I'm surprised that poking UI bits on the non-ui thread didn't crash/mess things up more.
That IS interesting that it didn't crash. But what's even more interesting is that the progress controls DID eventually hide AND the NSTextField hid immediately.
Thanks Chris. I'll try not to make that mistake again:).
Likely there is an update every minutes on Cocoa's end that happened to notice the variable was changed and your will/did were flat out ignored.
But no problem at all with the NSTextField.
It doesn't really matter whether it worked for some controls and not others. What matters is the correct way to do it is as @ChrisHamons described. No need for speculation.
The "correct" way is always the "best" way.