Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to System.ComponentModel.TypeConverter #1725

Merged
merged 24 commits into from
Jul 26, 2021
Merged

Conversation

Redth
Copy link
Member

@Redth Redth commented Jul 16, 2021

Forms used to define its own TypeConverter following the same convention of converting to/from an invariant string since netstandard1.x did not have the System.ComponentModel.TypeConverter.

This moves to using the standardized type which is expected more throughout the ecosystem.

TODO:

  • Bump MAUI Graphics version and use its ColorTypeConverter
  • Remove DesignTools ColorTypeConverter
  • Find a way to associate the attributes from the old ColorTypeConverter:
[Xaml.ProvideCompiled("Microsoft.Maui.Controls.XamlC.ColorTypeConverter")]
[Xaml.TypeConversion(typeof(Color))]
  • Look at TypeConverterAttribute in Controls and remove it
  • Remove need for KnownTypeConverters - this may mean moving some more converters to graphics/core from controls
  • Infer TypeConversionAttribute from context ??
  • drop IExtendedTypeConverter, use TypeConverter.ConvertFrom overload
  • What to do with UriTypeConverter ?

PR Checklist

  • Targets the correct branch
  • Tests are passing (or failures are unrelated)

@@ -9,7 +11,7 @@ namespace Microsoft.Maui.Controls
{
[Xaml.ProvideCompiled("Microsoft.Maui.Controls.XamlC.BindablePropertyConverter")]
[Xaml.TypeConversion(typeof(BindableProperty))]
public sealed class BindablePropertyConverter : TypeConverter, IExtendedTypeConverter
public sealed class BindablePropertyConverter : StringTypeConverterBase, IExtendedTypeConverter
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as ITypeDescriptorContext is a IServiceProvider, we probably could get rid of IExtendedTypeConverter (that adds a IServiceProvider parameter)

Redth and others added 10 commits July 21, 2021 07:38
Forms used to define its own TypeConverter following the same convention of converting to/from an invariant string since netstandard1.x did not have the `System.ComponentModel.TypeConverter`.

This moves to using the standardized type which is expected more throughout the ecosystem.
@Redth Redth added this to the 6.0.100-preview.7 milestone Jul 21, 2021
@Redth
Copy link
Member Author

Redth commented Jul 21, 2021

Added converters into Maui Graphics: dotnet/Microsoft.Maui.Graphics#126
Once merged will remove them from MAUI on this PR

@mattleibow mattleibow merged commit c248bda into main Jul 26, 2021
@mattleibow mattleibow deleted the improve-xaml-editing branch July 26, 2021 21:30
@samhouts samhouts added area-xaml XAML, CSS, Triggers, Behaviors area-architecture Issues with code structure, SDK structure, implementation details labels Jul 20, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Dec 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-architecture Issues with code structure, SDK structure, implementation details area-xaml XAML, CSS, Triggers, Behaviors
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants