Namespace change for Color and IValueConverter, to better support MVVM #171
Unanswered
johnshardman
asked this question in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
In Xamarin.Forms, both Color and IValueConverter appear in the Xamarin.Forms namespace.
As a result of IValueConverter being in the Xamarin.Forms namespace, putting value converters in ViewModels (which IMHO is where they would naturally sit) results in Xamarin.Forms references being dragged into the ViewModel layer which is unwanted. The ViewModel layer should not know about any particular UI-related framework.
This problem becomes worse in Xamarin.Forms when a value converter is converting state into a Color for presentation, as Color is also in the Xamarin.Forms namespace (although there are ways around that, using abstraction or indirection).
In Maui, it would make sense to use the Color that appears in System.Drawing.Color, as per #110 and to get rid of System.Maui.Color .
But that leaves the question of which namespace should contain IValueConverter be Maui? Ideally, not System.Maui , but I don't yet have a personal view on where it should be, hence starting this discussion. Ideas?
Beta Was this translation helpful? Give feedback.
All reactions