8

I am trying to host UWP Controls on my .NET Framework 4.8 Application. After I have installed the Microsoft.Toolkit.Forms.UI.XamlHost Nuget Package, I added a WindowsXamlHost component to the form. However, this error message popped up:

enter image description here

I have looked on Github, but found no luck in solving this problem.

How do I fix this?

theduck
  • 2,589
  • 13
  • 17
  • 23
Apollo199999999
  • 186
  • 3
  • 12
  • 1
    From [WindowsXamlHostControl for Windows Forms and WPF](https://learn.microsoft.com/en-us/windows/communitytoolkit/controls/wpf-winforms/windowsxamlhost): Important - Using the WindowsXamlHost control to host custom UWP controls is supported only in apps that target .NET Core 3. This scenario is not supported in apps that target the .NET Framework. – mcalex Dec 19 '19 at 07:29
  • @mcalex You can host _standard_ UWP controls in WPF or WinForms using .NET Framework or .NET Core. (see: [Host a standard UWP control in a WPF app using XAML Islands](https://learn.microsoft.com/en-us/windows/apps/desktop/modernize/host-standard-control-with-xaml-islands) To host a _custom_ UWP control in WPF or WinForms, .NET Core 3 is required though. (see:[Host a custom UWP control in a WPF app using XAML Islands](https://learn.microsoft.com/en-us/windows/apps/desktop/modernize/host-custom-control-with-xaml-islands) – ChrisPBacon Jan 14 '20 at 18:17
  • Did you install [Microsoft.Toolkit.Forms.UI.Controls](https://www.nuget.org/packages/Microsoft.Toolkit.Forms.UI.Controls)? – mcalex Jan 15 '20 at 05:35
  • @mcalex Yes, I installed it – Apollo199999999 Jan 15 '20 at 09:56
  • 2
    I also am getting this error. My application is .NET 4.7.2. and using VS v16.4.2. – ChrisPBacon Jan 15 '20 at 14:08

0 Answers0