Can I use WinUI 3 custom controls in WPF/WF application using xaml island? #8823
-
Can I use WinUI 3 custom controls in the WPF/WF application using XAML island? |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 7 replies
-
Yes. Depending on how you do things, you may have to implement an application class that implements IXamlMetadataProvider. You may also need to have the controls in a MSIX package or registered via Registration Free WinRT to make them activatable. |
Beta Was this translation helpful? Give feedback.
-
You may want to take a look at https://github.com/driver1998/Xamlception. It is not fully working though, sometimes it may crash on exit. |
Beta Was this translation helpful? Give feedback.
-
I converted the WinForms test sample into WPF and it seems to work correctly, apart the bug : #8806 |
Beta Was this translation helpful? Give feedback.
-
I assume it is because my monitor is scaled to 150% that I see the below. WPF in general is good at scaling, does anybody know if this is a general issue with the hosting? |
Beta Was this translation helpful? Give feedback.
-
Yes, I had only tested on 100% and I have hardcoded dimensions of SiteBridge without reading DPI : to be improved... |
Beta Was this translation helpful? Give feedback.
-
@castorix, I attempted to use the custom WinUI controls in the WPF application you provided, but encountered a COM exception. I have included a sample, a screenshot for your reference. WPF_XAML_Islands_WinUI3-master.zip Please share your suggestions on resolving this issue or anything I have missed? |
Beta Was this translation helpful? Give feedback.
I converted the WinForms test sample into WPF and it seems to work correctly, apart the bug : #8806
WPF_XAML_Islands_WinUI3