Skip to content

Commit

Permalink
[net7.0] Use same type converter for Brush as for Color to enable XAM…
Browse files Browse the repository at this point in the history
…L completion (#16639)

* Use same type converter for Brush as for Color to enable XAML completion

* Add converter for VisualElement.Background

* Update src/Controls/src/Core.Design/AttributeTableBuilder.cs

Co-authored-by: Samantha Houts <samhouts@users.noreply.github.com>

---------

Co-authored-by: ET <48451158+etvorun@users.noreply.github.com>
Co-authored-by: Rui Marinho <me@ruimarinho.net>
Co-authored-by: Samantha Houts <samhouts@users.noreply.github.com>
  • Loading branch information
4 people authored Aug 11, 2023
1 parent a5fe382 commit 1a483f6
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Controls/src/Core.Design/AttributeTableBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ public AttributeTableBuilder()
AddMemberAttributes("Microsoft.Maui.Controls.VisualElement", "FlowDirection",
new TypeConverterAttribute(typeof(FlowDirectionDesignTypeConverter)));

// We need to supersede type converter declared on VisualElement.Background,
// otherwise VS will use generic "all strings allowed" converter which
// does not expose color values, i.e. no XAML intellisense popup
AddMemberAttributes("Microsoft.Maui.Controls.VisualElement", "Background",
new TypeConverterAttribute(typeof(ColorDesignTypeConverter)));

AddMemberAttributes("Microsoft.Maui.Controls.ItemsView", "ItemsLayout",
new TypeConverterAttribute(typeof(ItemsLayoutDesignTypeConverter)));

Expand Down Expand Up @@ -61,6 +67,7 @@ public AttributeTableBuilder()
//new System.Windows.Markup.MarkupExtensionReturnTypeAttribute (),
);

AddTypeAttributes("Microsoft.Maui.Controls.Brush", new TypeConverterAttribute(typeof(ColorDesignTypeConverter)));
AddTypeAttributes("Microsoft.Maui.Graphics.Color", new TypeConverterAttribute(typeof(ColorDesignTypeConverter)));
AddTypeAttributes("Microsoft.Maui.GridLength", new TypeConverterAttribute(typeof(GridLengthDesignTypeConverter)));

Expand Down

0 comments on commit 1a483f6

Please sign in to comment.