Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extending ContentDialog with generics <T> stops autogenerated code #9613

Open
karmeye opened this issue May 6, 2024 · 1 comment
Open

Extending ContentDialog with generics <T> stops autogenerated code #9613

karmeye opened this issue May 6, 2024 · 1 comment
Labels
bug Something isn't working team-Markup Issue for the Markup team

Comments

@karmeye
Copy link

karmeye commented May 6, 2024

Describe the bug

ContentDialog can be extended as shown in the example here. This works fine but as soon as I add a generic type InitializeComponent and other autogenerated code is not generated anymore.

Steps to reproduce the bug

See the screenshots.

Expected behavior

Is this not supposed to work?

Screenshots

Screenshot 1

Adding generics

Screenshot 2

NuGet package version

WinUI 3 - Windows App SDK 1.5.3: 1.5.240428000

Windows version

Windows 11 (22H2): Build 22621

Additional context

I assume this is the case for all controls, not just ContentDialog.

Thanks

@karmeye karmeye added the bug Something isn't working label May 6, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added the needs-triage Issue needs to be triaged by the area owners label May 6, 2024
@codendone codendone added team-Markup Issue for the Markup team and removed needs-triage Issue needs to be triaged by the area owners labels May 10, 2024
@JohnnyWestlake
Copy link

JohnnyWestlake commented May 17, 2024

InitializeComponent requires you having a matching XAML file with a matching x:Class="MyClass" set on the root element. However the XAML schema used in UWP/WinUI 3 doesn't support generic class declarations so you can't actually do it.

(The WPF schema supports it :') )

You would need to have an intermediate declaration that solidifies an implementation like
public abstract class BoolContentDialog : ContentDialog<bool> { ... } and use that as the base of your class that wants a XAML file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working team-Markup Issue for the Markup team
Projects
None yet
Development

No branches or pull requests

3 participants