-
Notifications
You must be signed in to change notification settings - Fork 10.2k
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
Blazor Desktop Components Not Supporting Partial Classes for defining code in the code behind partial class #31715
Comments
Thanks for contacting us. |
I have a little more information to provide about this problem. |
I would like to know if you want me to create a simple repository to show that in every case, if you have a xaml file in a class library then partial classes with code behind does not work compile (even overriding the OnInitialized) in the partial class. |
@musictopia2 thank you for the bug report. This is specifically in WPF projects? If so, it's being tracked by this issue: dotnet/wpf#4421. That issue also describes an easy workaround that can unblock you in the meantime. |
I have a question. Can WPF be used for blazor desktop when .net 6 is released? I hope so because there is one scenario that requires wpf that winui does not have and that is the ability to play mp3, videos. Or even being able to open popup windows. What I ended up doing for my workaround is creating a razor class library and having the project just reference that one. When I did that, then I was able to use partial classes for no problem. That was an acceptable workaround. |
Yes, Blazor Desktop in WPF will be supported in .NET 6, along with WinForms, and .NET MAUI. |
Closing because this looks like a dup of dotnet/maui#1516, which will be fixed in the next preview. |
When i create a partial class and define a method in that partial class, the code won't even compile.
Good news is it works fine if using a razor class library. The bad news is in blazor desktop does not work currently.
I hope the problem can be fixed. Otherwise, it would need to be clear that developers would have to know that if they want to split out into partial classes and have code in the partial class then they have to use a razor class library.
The text was updated successfully, but these errors were encountered: