@Haviv Elbsz - Put a line of code:
await Task.Delay(timeout);
after:
RunButton.BackgroundColor = Colors.Green;
Use a suitable value for timeout
, say start from 100 to about 500. This gives the update time for UI.
I think your busy loop may not allow the UI to update the Button color setting and awaited Task.Delay() may do the trick to give the UI to update itself.
UPDATE:
The difference between Background and BackgroundColor is:
- Background is a Brush
- BackgroundColor is a Color
There is a subtle difference between a Brush and Color (Color is a property of Brush but not another way round).
But on Maui (and Xamarin) you can use either Background or BackgroundColor on elements like Buttons and layouts and the necessary conversion is done for us internally.
Sometimes Button color setting could appear problematic if there are App-wide style definitions (possibly automatically generated on App creation) do overriding. Worth checking if this applies to your App.