[Bug] On iOS + MacCatalyst, `AvatarView.BackgroundColor` Does Not Work
Description
This is a known-issue on iOS + MacCatalyst, noted in the AvatarView Pull Request.
It is a purposefully implemented workaround because there is a bug in .NET MAUI where it paints the BackgroundColor on top of the Image on iOS.
https://github.com/CommunityToolkit/Maui/blob/68b82412a7e31d961b7ec0da2909f38e2a07ff9a/src/CommunityToolkit.Maui/Views/AvatarView.shared.cs#L324-L341
Here's an example of what it looks like without the workaround when setting BackgroundColor = Colors.Black:
Link to Reproduction Sample
https://github.com/CommunityToolkit/Maui/tree/main/samples
Steps to Reproduce
- In Visual Studio, launch
CommunityToolkit.Maui.Sample.sln - In Visual Studio, set iOS as the target platform
- In Visual Studio, build/deploy an iOS app to a simulator or device
- In the iOS device, navigate to
Views / AvatarView Images Page - In the iOS device, confirm that the Image background color is
Transparent
Expected Behavior
The background color of the AvatarView should reflect the BackgroundColor property set by the developer.
Actual Behavior
AvatarView on iOS is hardcoded to set BackgroundColor to Colors.Transparent to work-around a .NET MAUI bug causing the BackgroundColor to be painted over top of the Image.
https://github.com/CommunityToolkit/Maui/blob/68b82412a7e31d961b7ec0da2909f38e2a07ff9a/src/CommunityToolkit.Maui/Views/AvatarView.shared.cs#L324-L341
Workaround
Unknown
Reproduction Imagery
In this example, BackgroundColor = Colors.White:
| iOS / MacCatalyst | Android |
|---|---|
![]() |
![]() |

