maui icon indicating copy to clipboard operation
maui copied to clipboard

Fix "Grey" cannot be used to set Background property

Open devanathan-vaithiyanathan opened this issue 1 year ago • 8 comments

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 image

After image

Colors has both, but not Brush. so we should fix this in one way or another for consistency

StephaneDelcroix avatar Aug 21 '24 14:08 StephaneDelcroix

/azp run

mattleibow avatar Aug 23 '24 12:08 mattleibow

Azure Pipelines successfully started running 3 pipeline(s).

azure-pipelines[bot] avatar Aug 23 '24 12:08 azure-pipelines[bot]

@devanathan-vaithiyanathan just waiting on your CLA acceptance :)

mattleibow avatar Aug 23 '24 12:08 mattleibow

@dotnet-policy-service agree

/azp run

PureWeen avatar Aug 26 '24 13:08 PureWeen

Azure Pipelines successfully started running 3 pipeline(s).

azure-pipelines[bot] avatar Aug 26 '24 13:08 azure-pipelines[bot]

Azure Pipelines successfully started running 3 pipeline(s).

azure-pipelines[bot] avatar Aug 27 '24 13:08 azure-pipelines[bot]

Azure Pipelines successfully started running 3 pipeline(s).

azure-pipelines[bot] avatar Aug 29 '24 13:08 azure-pipelines[bot]

Hi @PureWeen , I've added the missing screenshot for the VerifyGreyShades test case. I think the test will pass now.

/azp run

rmarinho avatar Aug 30 '24 16:08 rmarinho

Azure Pipelines successfully started running 3 pipeline(s).

azure-pipelines[bot] avatar Aug 30 '24 16:08 azure-pipelines[bot]