microsoft / xaml-designer-extensibility

Extensibility sample code for the Visual Studio XAML Designer
MIT License
67 stars 29 forks source link

2 attributes for enabling "Suggested Actions" #24

Closed arivoir closed 3 years ago

arivoir commented 4 years ago

Why do we need to add 2 attributes to enable "Suggested Actions"

Builder.AddCustomAttributes("C1.WPF.Core.C1PathIcon", new SuggestionsAttribute());
Builder.AddCustomAttributes("C1.WPF.Core.C1PathIcon", new FeatureAttribute(typeof(C1PathIconSuggestedActionProvider)));

DefaultInitializer seems an analogous feature that only needs one

Builder.AddCustomAttributes("C1.WPF.Core.C1PathIcon", new FeatureAttribute(typeof(C1PathIconInitializer)));

Why 2 attributes?

arivoir commented 4 years ago

Additionally, the control full type "C1.WPF.Core.C1PathIcon" needs to be specified twice 2.

When adding the attribute

Builder.AddCustomAttributes("C1.WPF.Core.C1PathIcon", new FeatureAttribute(typeof(C1PathIconSuggestedActionProvider)));

And in the SuggestedActionProvider class

public class C1PathIconSuggestedActionProvider : SuggestedActionProvider
{
    public override string Type => "C1.WPF.Core.C1PathIcon";
}

What is the reason to having to specify this twice? The DefaultInitializer api looks much cleaner, only one attribute, and it doesn't need to report its "Type"

thsparks commented 3 years ago

Hi. Thanks for bringing this to our attention. In the latest preview, you should no longer have to register a separate SuggestionsAttribute (see updated documentation here: metadata registration), and we have removed the Type field.