-
-
Notifications
You must be signed in to change notification settings - Fork 2.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
Add AvaloniaView for WinUI #12782
Comments
How well does WinUI interop with Win32? Do they share the event loop? If so, a WinUI-based view class could live side-by-side with our normal Win32 backend and share the rest of the services like clipboard, GPU support and other stuff. |
@kekekeks since the death of UWP, all apps are Win32 apps. What's noteworthy about UWP, WinUI, WinRT, WindowsAppSDK stuff:
To summarize: everything is Win32 now, except when you explicitly call WinRT APIs. The UI is a special case of course. The WinUI controls are COM classes (but you in you daily dev job, don't see any of this) and the real UI lives in native code behind the COM abstraction (but again, when you write your you UI you don't see any of this, you only work with managed classes and visual tree). call-stack of an WinUI app-launch
This might be interesting:
default generated bootstrapping code without DISABLE_XAML_GENERATED_MAIN=true
#if !DISABLE_XAML_GENERATED_MAIN
public static class Program
{
[System.Runtime.InteropServices.DllImport("Microsoft.ui.xaml.dll")]
private static extern void XamlCheckProcessRequirements();
[System.STAThread]
static void Main(string[] args)
{
XamlCheckProcessRequirements();
WinRT.ComWrappersSupport.InitializeComWrappers();
Microsoft.UI.Xaml.Application.Start((ApplicationInitializationCallbackParams p) =>
{
Microsoft.UI.Dispatching.DispatcherQueue dispatcherQueue = Microsoft.UI.Dispatching.DispatcherQueue.GetForCurrentThread();
var context = new Microsoft.UI.Dispatching.DispatcherQueueSynchronizationContext(dispatcherQueue);
System.Threading.SynchronizationContext.SetSynchronizationContext(context);
new App();
});
}
#endif If I'm (from my level) interpreting this correct, these two lines are the most interesting. One COULD Microsoft.UI.Dispatching.DispatcherQueue dispatcherQueue = Microsoft.UI.Dispatching.DispatcherQueue.GetForCurrentThread();
var context = new Microsoft.UI.Dispatching.DispatcherQueueSynchronizationContext(dispatcherQueue);
System.Threading.SynchronizationContext.SetSynchronizationContext(context); |
Do they still use that "Only one thread per window" model? |
@kekekeks sorry, IDK if they use "Only one thread per window". But after letting all the infos sink in, i now understand why it wasn't done yet. Fun fact, with recently released App SDK, they added the inverse API. I guess, if one is determined, one could do things like putting an empty placeholder in your WinUI Layout, and then in the Win32 App render an Avalonia Control at this postion over the . |
Is your feature request related to a problem? Please describe.
Fer a gradual migration of WinUI/MAUI-Windows it‘s necessary to have a AvaloniaView which can be placed anywhere in the app an renders ava, like you did in the sample AvaloniaMauiHybrid for Android and iOS.
The body (without page layout, burger menu, etc) of new developed page in our LOB application, would be written in Ava, and then inserted as AvaloniaView in an existing WunUi/MAUI Page Layout.
Then, when there‘s the need to refactor an old page, rewrite it to Avalonia.
When everything else is done: replace the surrounding page-Layout with avalonia.
This might take 24 months. We cannot shut our app down during this kind of migration.
Describe the solution you'd like
An AvaloniaView like on every other platform (iOS, Android, Blazor, etc.)
Describe alternatives you've considered
At the moment, I try to solve it myself. But in the end it would be a NO for adopting/subscribing avalonia. The alternative we consider is MauiBlazorHybrid.
Additional context
It’s essentially a feature request, to get something like this working: AvaloniaUI/AvaloniaMauiHybrid#7
The text was updated successfully, but these errors were encountered: