Tooling-Windows-Submodule icon indicating copy to clipboard operation
Tooling-Windows-Submodule copied to clipboard

Feature: Add EnumOptionAttribute

Open Poker-sang opened this issue 1 year ago • 1 comments

Use:

[ToolkitSampleEnumOption<Visibility>("MyVisibility", Title = "Visibility")]
public partial class Sample : UserControl;

instead of

[ToolkitSampleEnumOption("MyVisibility", "Visible", "Collapsed", Title = "Visibility")]
public partial class Sample : UserControl;

And generate accurate enum type for ToolkitSampleEnumOption:

public Windows.UI.Xaml.Controls.Visibility MyVisibility
{
    get => (Windows.UI.Xaml.Controls.Visibility)(...)!.Value!;
    set ...
}

All the changes are AOT compatiable

Poker-sang avatar Nov 18 '24 08:11 Poker-sang

Good to see that new C# 12 features might make this a bit simpler to set up.

However, we should be doing an evaluation of existing code before making refactors like this. We had custom logic for added flexibility, and this would need to be assessed and planned out before making improving.

We'll keep the PR around for now, but let's get a ticket open to track our rationale and methodology.

Arlodotexe avatar Feb 11 '25 17:02 Arlodotexe