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

Possible Interop Story WinRT #4045

Open
AngelMunoz opened this issue May 30, 2020 · 7 comments
Open

Possible Interop Story WinRT #4045

AngelMunoz opened this issue May 30, 2020 · 7 comments

Comments

@AngelMunoz
Copy link

Hi everyone
Is it possible to implement the IInitializeWithWindow and IWindowNative with an Avalonia Application?
sample here
https://github.com/microsoft/WinUI-3-Demos/tree/master/DemoBuildCs/DemoBuildCs/DemoBuildCs
I was doing some experimentation with the C#/WinRT projection Microsoft released in past weeks while I could make UI-less APIs work (samples here https://github.com/AngelMunoz/WinRTFs)
I was wondering if it's possible to do something like that in an Avalonia App, that could allow Avalonia apps to have some degree of integration with the system like camera UI's User activities, file/folder pickers, auth dialogs, and some other nice stuff, I have this comment for context
microsoft/CsWinRT#287 (comment)

Copied from Gitter

@kekekeks
Copy link
Member

@jkoritzinsky It seems that WinRT interop doesn't actually require us retargeting to .NET Core. Am I missing something?

@kekekeks
Copy link
Member

Some relevant links:
dotnet/runtime#36715
https://github.com/microsoft/CsWinRT

@jkoritzinsky
Copy link
Collaborator

For our usage, we should be able to swing targeting .NET Standard 2.0 as long as we use the Microsoft.Windows.Sdk.Net package. However, that package is a bit large, so it might be worth multi targeting.

@AngelMunoz
Copy link
Author

For our usage, we should be able to swing targeting .NET Standard 2.0 as long as we use the Microsoft.Windows.Sdk.Net package. However, that package is a bit large, so it might be worth multi targeting.

I think that was the prior way to target WinRT, the projection seems that's the new and recommended way to do so as mentioned on the PR above, the projection will target netstandard2.0 as well as .net5 when it comes out, not sure what will happen to the sdks though

@jkoritzinsky
Copy link
Collaborator

The old way was to use the Microsoft.Windows.Sdk.Contracts package. The Microsoft.Windows.Sdk.NET package is the new way. We should not be running CsWinRT directly.

@AngelMunoz
Copy link
Author

hi @jkoritzinsky sorry to bother I saw this comment microsoft/CsWinRT#355 (comment)

CsWinRT now supports ComImport-attributed interfaces directly.

I've tried to check samples about the IInitializeWindow interface but to be honest I always feel quite lost.

In short is this something that we can achieve in Avalonia right now? or are we still limited in some way

@jkoritzinsky
Copy link
Collaborator

Possibly. The ComImport support is primarily around consuming a native type via the ComImport interfaces, not writing a type that uses them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants