I’m excited to announce the next major update of the Windows Community Toolkit, version 5.0. This update introduces the new WindowsXamlHost control built on top of the new XAML Islands APIs to simplify adding built-in or custom UWP control to a WPF or Windows Forms desktop application. Alongside, this version introduces new WinForms and WPF controls that leverage the WindowsXamlHost interfaces to wrap UWP platform controls such as the InkCanvas and the MapControl.

In addition, version 5.0 also introduces the TabView control for UWP, a new .NET Standard Weibo service, new .NET Framework support for the Twitter and LinkedIn service, and many new bug fixes and feature updates to existing controls and helpers.

Let’s take a look at the highlights in more details.

WindowsXamlHost

The latest version of Windows 10 (1809) introduces new pre-release APIs to enable UWP controls in a non-UWP Win32 desktop application to enhance the look, feel, and functionality of the experience with the latest UI features that are only available via UWP controls.

To make it easier for WPF and Windows Forms developers to use any UWP control that derives from the UWP UIElement, the toolkit introduces the WindowsXamlHost control to host built-in or custom UWP control. The control is currently available as a developer preview today and we encourage developers to try it out in their own prototype code.

To make it easier for WPF and Windows Forms developers to use any UWP control that derives from the UWP UIElement, the toolkit introduces the WindowsXamlHost control to host built-in or custom UWP control.

Make sure to visit the documentation to learn more about how the new control works and how to add UWP UI to your desktop apps.

Wrapped Controls

Built on top of the WindowsXamlHost interfaces, the toolkit also introduces a selection of wrapped UWP controls. These controls wrap the interface and functionality of a specific UWP platform control. These controls can be added directly to the design surface of a WPF or Windows Forms project and can be used like any other control.

Windows Forms project.

With this release, the following controls are available:

  • WebView – a control that uses the Microsoft Edge rendering engine – supported on Windows 10 April 2018 update and above
  • WebViewCompatible – a control that provides a version of WebView that is compatible with more OS versions. The control uses the WebView control on OS versions that support it and the Internet Explorer rendering engine otherwise, even on Windows 8 and Windows 7.
  • InkCanvas and InkToolbar – wrapper around the UWP WinkCanvas and InkToolbar controls to enable Ink based user interaction – supported on Windows 10 October 2018 update and above
  • MediaPlayerElement – wrapper around the UWP MediaPlayerElement to stream and render media content such as video – supported on Windows 10 October 2018 update and above
  • MapControl – wrapper around the UWP MapControl control to display and interact with rich Map content – supported on Windows 10 October 2018 update and above

As with the WindowsXamlHost control, these controls are currently available as a developer preview and we encourage developers to try them out in their own prototype code.

TabView control

After hundreds of comments on GitHub and two years of discussions, the UWP TabView control is now available in the Windows Community Toolkit. The TabView control allows you to provide a rich Tab experience, with support for fully customizing the behavior, built in support for closing tabs, drag and drop and more.

The TabView control allows you to provide a Tab experience, with support for customizing the behavior, built in support for closing tabs, drag and drop and more

Make sure to visit the documentation and checkout the sample in the sample app.

Weibo service

With only few lines of code, developers can now easily retrieve or publish data to the very popular Weibo social platform. The service is built on .NET Standard and can be used on any platform including UWP, .NET Framework, Xamarin and more.


// Initialize service
WeiboService.Instance.Initialize(AppKey, AppSecret, RedirectUri);

// Login to Weibo
if (await WeiboService.Instance.LoginAsync())
{
    // Post a status with a picture
         await WeiboService.Instance.PostStatusAsync(StatusText.Text, stream);
}

Visit the documentation for more details on how to create your Weibo application.

Twitter and LinkedIn .NET Framework support

In version 4.0 of the toolkit, the Twitter and LinkedIn services moved from UWP to .NET Standard. In this new release, the community continued to improve the cross platform experience by building the .NET Framework platform specific implementation required for authentication to enable OAuth on WPF and Windows Forms.

Get started today

There is a lot more updates than we can cover in this blog post, so make sure to read the release notes.

As a reminder, you can get started by following this tutorial, or preview the latest features by installing the Windows Community Toolkit Sample App from the Microsoft Store. If you would like to contribute, please join us on GitHub! To join the conversation on Twitter, use the #WindowsToolkit hashtag.

Happy coding!

Source: Windows Blog