Can I use custom winUI 3 Controls in wpf application? #8808
Replies: 2 comments
-
With the last version(1.4), you can use Microsoft.UI.Xaml.Hosting.DesktopWindowXamlSource |
Beta Was this translation helpful? Give feedback.
-
For WinUI 3, you would have to use the Windows App SDK package. The Windows App SDK is documented to include WinUI 3. For hosting, you treat the Xaml Island content as a HWND which you can get through the DesktopWindowXamlSource's SiteBridge property. It uses Microsoft.UI.WindowId to represent the HWND and you need to use the GetWindowFromWindowId and GetWindowIdFromWindow to convert between them. Right now is also not the easiest time to attempt this. First, the documentation is still incomplete. Most of the new documentation is still stubs. There is also the fact that the current implementation doesn't have any C# wrappers, this means you have to work with the raw HWND to put it into the WPF tree. Finally, if you want to use resources from XamlControlsResources, then you need to set up some extra things which you will have to implement yourself. |
Beta Was this translation helpful? Give feedback.
-
Can I use custom winUI 3 Controls in wpf application? and also do I have to use microsoft.UI.xaml package to use winUI 3 controls in WPF?
Beta Was this translation helpful? Give feedback.
All reactions