Replies: 1 comment
-
Any news on this? we are pretty much stuck without it as our shared code will not work on MAUI |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Description
Add implicit operators, similar as it was in Xamarin.Forms or make System.Drawing.Color a base class for Microsoft.Maui.Graphics.Color
Currently binding of System.Drawing.Color property from viemodel causes error (technically warning):
Microsoft.Maui.Controls.Xaml.Diagnostics.BindingDiagnostics: Warning: 'Color [White]' cannot be converted to type 'Microsoft.Maui.Graphics.Color'
Public API Changes
From Xamarin.Forms Color struct:
#if !NETSTANDARD1_0
public static implicit operator System.Drawing.Color(Color color)
{
if (color.IsDefault)
return System.Drawing.Color.Empty;
return System.Drawing.Color.FromArgb((byte)(color._a * 255), (byte)(color._r * 255), (byte)(color._g * 255), (byte)(color._b * 255));
}
#endif
Intended Use-Case
The ViewModels project is a class library shared between Xamarin.Forms and Maui projects as a project reference.
In ViewModels there is a lot of bindings which map to System.Drawing.Color.
ViewModels project attached to Xamarin.Forms works fine because implicit convertes exist. Because of suggested change this will be possible also in Maui projects and thousands of run time errors would be gone.
Beta Was this translation helpful? Give feedback.
All reactions