microsoft / WindowsAppSDK

The Windows App SDK empowers all Windows desktop apps with modern Windows UI, APIs, and platform features, including back-compat support, shipped via NuGet.
https://docs.microsoft.com/windows/apps/windows-app-sdk/
MIT License
3.85k stars 326 forks source link

FeatureManagement API for Windows Applications #1073

Open LadderLogic opened 3 years ago

LadderLogic commented 3 years ago

feature proposal

ASP .NET Core has great support for Feature Modeling using Microsoft.FeatureManagement. The feature filter feature is available at both controller and view level (from microsoft/FeatureManagement-Dotnet):

<feature name=@nameof(MyFeatureFlags.FeatureX)>
  <p>This can only be seen if 'FeatureX' is enabled.</p>
</feature>

Would it be possible to extend the FeatureManagement API to work with Windows Applications including XAML support like this?

<StackPanel Feature:IsEnabled="FeatureX">
        <Button Click="button_Click">Start Feature X</Button>
</StackPanel>

For additional context, here's a description of ASP.NET Core's feature management:

It provides a centralised but extensible way for adding feature flags to your system. This lets you roll out new features to a subset of users, limiting the availability of a feature by time, or performing A/B tests, for example.

sylveon commented 3 years ago

Is this not something that can be done using function bindings?

<StackPanel Visibility="{x:Bind _featureManager.IsEnabled('FeatureX')}">
    <Button Click="button_Click">Start Feature X</Button>
</StackPanel>

Your example syntax could actually even work today, provided an attached property is used.

In any case, I don't think this is worth adding a language-specific feature to XAML (keep in mind XAML must support C++ as well).

LadderLogic commented 3 years ago

Is this not something that can be done using function bindings?

<StackPanel Visibility="{x:Bind _featureManager.IsEnabled('FeatureX')}">
    <Button Click="button_Click">Start Feature X</Button>
</StackPanel>

Your example syntax could actually even work today, provided an attached property is used.

In any case, I don't think this is worth adding a language-specific feature to XAML (keep in mind XAML must support C++ as well).

@sylveon This is in fact what I've done in my previous WPF/XAML projects, to wire-up my own XAML markup extensions, attached properties and other plumbing for feature management. I am not suggesting a XAML fix, but adding a feature to the framework/SDK. Similar to how ASP .NET Core has FeatureManagement API, I am suggesting that there should be an SDK level Feature Management option.

yoshiask commented 3 years ago

Like @sylveon said, you can accomplish this with an attached property, I don't see why it's necessary to add it to the SDK itself. Maybe this is something that can be added to https://github.com/CommunityToolkit/WindowsCommunityToolkit?