You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some properties are bound like obj in the json file to allow implicit conversion just like we would do in XAML.
E.g. Image.Source can be set as a string or as an ImageSource.
Or GridRowDefinition can be either "*" or GridLength.Star
Same with View.Margin
But when using such types, IntelliSense only shows that the property is obj.
Developers don't know about the implicit conversions (if they didn't check the samples) and must look into the documentation of Xamarin.Forms to know what type exactly is allowed.
Wouldn't changing those obj to discriminated unions be better?
It would make typing explicit to developers, while allowing the compiler to check if there's nothing funny going on.
And cherry on top, converters would output warnings if we're missing a case (which is not the case currently with type matching)
What do you think?
The text was updated successfully, but these errors were encountered:
I think F# should have type-tagged union types (string|ImageSource) (erased to obj). I am hoping we can add those in F# 5.0, partly driven by exactly this question
I think it will take longer,. maybe a year to see through to all relevant tooling. I feel using "obj" is likely ok for now, as people nearly always do view elements via cut-and-paste snippets, but I know it's not ideal.
Some properties are bound like
obj
in the json file to allow implicit conversion just like we would do in XAML.E.g. Image.Source can be set as a
string
or as anImageSource
.Or GridRowDefinition can be either
"*"
orGridLength.Star
Same with View.Margin
But when using such types, IntelliSense only shows that the property is
obj
.Developers don't know about the implicit conversions (if they didn't check the samples) and must look into the documentation of Xamarin.Forms to know what type exactly is allowed.
Wouldn't changing those
obj
to discriminated unions be better?It would make typing explicit to developers, while allowing the compiler to check if there's nothing funny going on.
And cherry on top, converters would output warnings if we're missing a case (which is not the case currently with type matching)
What do you think?
The text was updated successfully, but these errors were encountered: