IssueRaiser

Proposal: Generic types in WinUI XAML

# Proposal: Enable generic types in UWP XAML Currently it's impossible to inherit from a generic type and specify generic type arguments in UWP XAML. ## Summary **Elsewhere / API:** ```c# public class ReactivePage<TViewModel> : Page, IViewFor<TViewModel> where TViewModel : class { /* ... */ } ``` **XAML:** ```xml <rxui:ReactivePage x:Class="v:MainPage" x:TypeArguments="vm:MainPageViewModel" xmlns:rxui="using:ReactiveUI" xmlns:v="using:MyProject.Views" xmlns:vm="using:MyProject.ViewModels" /> ``` **Code behind:** ```c# public class MainPage : ReactivePage<MainPageViewModel> { /* ... */ } ``` ## Rationale The WPF XAML supports the [`TypeArguments`](https://docs.microsoft.com/en-us/dotnet/framework/xaml-services/x-typearguments-directive) XAML directive. My request here is to support this functionality in UWP XAML as well. P.S. Imigrated from [here](https://developercommunity.visualstudio.com/content/idea/610869/support-generic-type-arguments-in-uwp-xaml.html)

Posted by weitzhandler on Jun 22, 2019, 8:09 PM

Tags

Related issues

Raise real-world problems, find people facing the same issue, and discuss solutions.3,500 issues0 comments

support (Other)

Proposal: Generic types in WinUI XAML

weitzhandlerJun 22, 2019, 8:09 PM

# Proposal: Enable generic types in UWP XAML Currently it's impossible to inherit from a generic type and specify generic type arguments in UWP XAML. ## Summary **Elsewhere / API:** ```c# public class ReactivePage<TViewModel> : Page, IViewFor<TViewModel> where TViewModel : class { /* ... */ } ``` **XAML:** ```xml <rxui:ReactivePage x:Class="v:MainPage" x:TypeArguments="vm:MainPageViewModel" xmlns:rxui="using:ReactiveUI" xmlns:v="using:MyProject.Views" xmlns:vm="using:MyProject.ViewModels" /> ``` **Code behind:** ```c# public class MainPage : ReactivePage<MainPageViewModel> { /* ... */ } ``` ## Rationale The WPF XAML supports the [`TypeArguments`](https://docs.microsoft.com/en-us/dotnet/framework/xaml-services/x-typearguments-directive) XAML directive. My request here is to support this functionality in UWP XAML as well. P.S. Imigrated from [here](https://developercommunity.visualstudio.com/content/idea/610869/support-generic-type-arguments-in-uwp-xaml.html)

Comments (0)

No comments yet. Start the discussion.

Comment on this issue