Site icon 지락문화예술공작단

XAML Islands v1 – Updates and Roadmap

XAML Islands v1 – Updates and Roadmap

At Microsoft Build, we announced that the Windows 10 May 2019 Update (version 1903) would include XAML Islands v1.

Below you can find more details on the roadmap and two workstreams in progress to complete the developer experience: the .NET wrappers and Visual Studio 2019 support.

What are XAML Islands?

XAML Islands enable .NET and native Win32 applications to host UWP XAML controls. You can enhance the experience and functionality of your existing desktop applications with the latest UI innovations previously only available for UWP apps. For example, you can use the UWP XAML controls such as ColorPicker, InkCanvas, CalendarView, and NavigationView in your existing C++ Win32, Windows Forms, and WPF applications.

With XAML Islands you can modernize your app at your own pace without having to rewrite your app–just use the UWP XAML controls.

How can I use XAML Islands?

The first component is the UWP XAML hosting API. This is a set of Windows 10 APIs (Windows Runtime classes and COM interfaces) that are shipped within the Windows 10 version 1903. If you have a native C++ Win32 app that is using the Common Controls library (Comctl32.dll) or MFC and you need to modernize your UI, use these APIs.

The second component consists of the .NET wrapped controls and the host controls. Those are a set of UWP XAML hosting API wrappers in the Windows Community Toolkit for both Windows Forms and WPF developers.

What are the requirements for using XAML Islands in my application?

Note: Unpackaged apps will have a limited support in this release, but some scenarios will be possible.

What versions of .NET Core and .NET Framework can I target with XAML Islands?

The .NET wrapped controls are supported in .NET Framework and .NET Core 3. The .NET host control (WindowsXamlHost) is available for Windows Forms and WPF. This control allows you to host UWP XAML content. If the UWP XAML content is a control that ships with the Windows 10 platform such as ColorPicker or NavigationView, you can target the .NET Framework 4.7.2 or NET Core 3.

If the UWP XAML content is a UWP user control that is implemented in a 3rd party WinRT component, the version of .NET you can target depends on how the user control was developed. A user control is considered a 3rd party WinRT component if it is defined in one of these ways: in a separate UWP project, in a Nuget Package, or via a link to file.

This is the matrix of platform support for XAML Islands v1:

If your app targets .NET Core 3, regardless of whether the 3rd party WinRT component you are hosting is native or managed, you will get a streamlined developer experience. If your app targets the full .NET Framework, you will get a streamlined developer experience only if your 3rd party WinRT component is native.

How can I use XAML Islands in my native C++ Win32 app?

If you’re a C++ developer, you need to use the UWP XAML hosting APIs. These are some basic steps:

  1. First initializes the UWP XAML framework in the current thread (you can use thestatic InitializeForCurrentThreadmethod of the WindowsXamlManager class).
  2. Create a DesktopWindowXamlSource object that requires the HWND of your app. The DesktopWindowXamlSource will create a ChildWindow where you can place the XAML content.
  3. You need to take care of the keyboard focus when users navigate into and out of the XAML Islands. This DesktopWindowXamlSource object exposes event for routing keyboard focus navigation.

You can find more details at: https://docs.microsoft.com/en-us/windows/apps/desktop/modernize/using-the-xaml-hosting-api

How can I use XAML Islands in my .NET App?

The Windows Community Toolkit version 6.0.0 (in preview right now) provides several NuGet packages for Windows Forms and WPF that you can add to your project.

The WindowXamlHost control is a host control in which you can host all kinds of UWP XAML content.

The wrapped controls wrap most of the events and properties of a small set of specific UWP controls into WPF and Windows Forms controls. These wrapped controls are designed to be used as regular Windows Forms and WPF controls so you don’t need to understand UWP concepts. Currently we provide these wrapped controls:

What modern web view controls are available to desktop applications?

Windows Forms and WPF apps use the WebBrowser control, which uses the Internet Explorer rendering engine and therefore lacks support for HTML5 and other features. The Windows Community Toolkit contains a Windows Forms and WPF wrapper for the UWP WebView control that uses Edge as the rendering engine, so these apps can host web content that requires HTML5.

The Windows Community Toolkit also contains the WebViewCompatible control. This control uses either the WebBrowser or the WebView rendering engine, depending on the version of Windows the app is running on:

Are the XAML Islands using a different thread?

No. XAML Islands run on the same UI thread of your desktop app. You can access all the UWP XAML objects from your code behind without doing any marshalling. This is different from Windows Forms and WPF hosted technologies.

Any samples?

XAML Islands Lab is a comprehensive lab that provides step-by-step instructions for using the wrapped controls and host controls in the Windows Community Toolkit to add UWP controls to an existing WPF line-of-business application. This lab includes the complete code for the WPF application as well as detailed instructions for each step in the process.

This C++ Win32 Sample demonstrates a complete implementation of hosting a UWP user control in an unpackaged C++ Win32 application (that is, an application that is not built into an MSIX package).

For a WPF .NET Core 3 app that consumes a UWP project within a User Control you can use this one:

The Windows community Toolkit contains demos to validate the wrapped control and the host control.

What is your roadmap for XAML Islands v1?

1. Windows 10 May 2019 update contains the first release of XAML Islands (v1).

2. The Windows Community Toolkit, v6.0, will contain the WindowsXamlHost and wrapped controls for the .NET Framework.

3. Visual Studio 2019 will get an update in the second half of 2019, aligned with the release of .NET Core 3 that will support XAML Islands v1. Remember that only packaged apps will get a streamlined developer experience.

What is your roadmap for XAML Islands v2?

XAML Islands v2 is intended to ship as a part of WinUI 3.0. Therefore, v2 will support the same Windows 10 versions as WinUI 3.0. We are planning to release v3 major release of WinUI during the first half of 2020. WinUI is an open source project, and you can follow  the latest roadmap and news at: https://github.com/microsoft/microsoft-ui-xaml/blob/master/docs/roadmap.md

What are the best ways for me to give you feedback about XAML Islands?

The post XAML Islands v1 – Updates and Roadmap appeared first on Windows Blog.

Source: XAML Islands v1 – Updates and Roadmap

Exit mobile version