Specifically with Background="Transparent" set, which both removes the background colour but also removes the hover and click effects. Easier to see (and possibly seems to occur more) with a lower MaximumHeightRequest set (eg 100).
<ImageButton
x:Name="CounterBtn"
Source="dotnet_bot.png"
Background="Transparent"
MaximumHeightRequest="100"
SemanticProperties.Hint="Counts the number of times you click"
Clicked="OnCounterClicked"
HorizontalOptions="Fill" />
Change the default Button ("CounterBtn") to an ImageButton. Remove the Text attribute
Set Source="dotnet_bot.png", and Background="Transparent"
Optionally set MaximumHeightRequest="100"
In OnCounterClicked(...) remove all code and add CounterBtn.Source = "dotnet_bot.png";
Click the button (may take multiple attempts) and observe a very fast flicker when the source is changed
Expected outcome: Image changes, no flicker
Actual outcome: Image disappears for a fractional amount of time, then new image appears
Verified this on VS 17.10.0 Preview 2.0(8.0.14). Repro on Windows 11 and MacCatalyst, not repro on Android 14.0-API34 and iOS 17.2 with below Project:
21122.zip
Description
Specifically with Background="Transparent" set, which both removes the background colour but also removes the hover and click effects. Easier to see (and possibly seems to occur more) with a lower MaximumHeightRequest set (eg 100).
Very similar to an old issue, though now specifically with ImageButton. https://github.com/dotnet/maui/issues/6962
Full modifications to default project:
MainPage.xaml
MainPage.xaml.cs
Steps to Reproduce
CounterBtn.Source = "dotnet_bot.png";
Demonstration: https://github.com/dotnet/maui/assets/22117135/85ba4dcc-42db-4a40-b12e-12cf73a541e6
Link to public reproduction project repository
No response
Version with bug
8.0.6 SR1
Is this a regression from previous behavior?
Not sure, did not test other versions
Last version that worked well
Unknown/Other
Affected platforms
Windows
Affected platform versions
No response
Did you find any workaround?
No response
Relevant log output
No response