maui
maui copied to clipboard
Fix "Grey" cannot be used to set Background property
Root cause
The issue occurred because .NET MAUI's Brush class does not support color names with the British spelling "Grey" (e.g., Grey, DimGrey, SlateGrey). Instead, it only recognizes the American spelling "Gray." This led to a XFC0040 Cannot convert value "Grey" to "Microsoft.Maui.Controls.Brush" error when trying to use these color names in XAML.
Description of Change
To resolve this issue, I added the missing colors using the "Grey" spelling (Grey, DimGrey, SlateGrey, DarkGrey, DarkSlateGrey, LightGrey, LightSlateGrey). This fix ensures that these colors are now recognized and can be used in XAML.
Note: There is a known Visual Studio bug where the XAML preview does not display these colors correctly, even after the fix.
Issues Fixed
Fixes #21325
Output
Before
After
Colors has both, but not Brush. so we should fix this in one way or another for consistency
/azp run
Azure Pipelines successfully started running 3 pipeline(s).
@devanathan-vaithiyanathan just waiting on your CLA acceptance :)
@dotnet-policy-service agree
/azp run
Azure Pipelines successfully started running 3 pipeline(s).
Azure Pipelines successfully started running 3 pipeline(s).
Azure Pipelines successfully started running 3 pipeline(s).
Hi @PureWeen , I've added the missing screenshot for the VerifyGreyShades test case. I think the test will pass now.
/azp run
Azure Pipelines successfully started running 3 pipeline(s).