All posts by Nikola Metulev

Announcing Windows Community Toolkit v5.0 – Windows Developer Blog

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.

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.

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.

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.

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.

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.

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

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.

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.

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!
Updated October 31, 2018 10:40 am

#ifdef WINDOWS – MIDL 3 with Larry Osterman – Windows Developer Blog

Microsoft Interface Definition Language (MIDL) 3.0 is a simplified, modern syntax for declaring Windows Runtime types inside Interface Definition Language (IDL) files (.idl files). It is a particularly convenient way to declare C++/WinRT runtime classes.
In this video, Larry Osterman, lead developer on the COM team in Windows, gave us a deep dive in MIDL and how it all ties in the Windows Runtime. Larry shared how MIDL started and how it got to where it is today. Watch the full video above and feel free to reach out on Twitter or in the comments below for questions or comments.
Happy coding!
#ifdef WINDOWS is a periodic dev show by developers for developers focused on Windows development through interviews of engineers working on the Windows platform. Learn why and how features and APIs are built, how to be more successful building Windows apps, what goes into building for Windows and ultimately how to become a better Windows developer. Subscribe to the YouTube channel for notifications about new videos as they are posted, and make sure to reach out on Twitter for comments and suggestions.

Announcing Windows Community Toolkit v4.0 – Windows Developer Blog

The Windows Community Toolkit recently reached over 1 million downloads across all nuget packages. This is a very big milestone for the community and I’m very excited to announce yet another major update to the Windows Community Toolkit, version 4.0. With the help of the Windows community, this update introduces several new additions and improvements, specifically:New DataGrid with fluent design for all UWP developers
Two new Microsoft Graph controls. PowerBIEmbedded enables embedding PowerBI dashboards in your UWP apps and PlannerTasksList allows users to work with Microsoft Planner tasks
The Twitter, LinkedIn, and Microsoft Translator services have moved to the .NET Standard services package and available to even more developers, including desktop and Xamarin developers
Strong-named packages for those developers that require strong-named assemblies
Dark theme support for the sample app and theme chooser for each sample
These are some of the biggest updates in this release and I encourage you to view the full release notes on our GitHub. Let’s take a look at some of these updates in more details.

New fluent DataGrid control
We had introduced a preview of a fluent DataGrid control for Windows 10 in Version 3.0. In the past several months, we have added a few more features based on community feedback, ensured more reliability and better accessibility for the DataGrid control. We are now pleased to announce the general availability of the DataGrid control.
The DataGrid control is a robust control that provides a flexible way to display a collection of data in rows and columns. It retains the programming model for DataGrid from Silverlight and WPF so it is familiar to XAML developers who have used the DataGrid control in older XAML technologies. Developers can now create highly flexible tabular visualization of data with editing, data validation and data shaping functionalities with a few simple lines of code in Windows 10:

Make sure to visit the DataGrid documentation to learn about the capabilities of the DataGrid control with detailed guidance documents and How-Tos with code samples. DataGrid comes in a standalone nuget package that you can download and add reference to.
New Microsoft Graph controls
Version 3 of the toolkit introduced a new category of UWP controls to enable developers access the Microsoft Graph. With few lines of code, developers can add UI to enable users to log in to the Microsoft Graph, search for coworkers and friends, browse SharePoint files and more. Version 4.0 introduces two new Microsoft Graph controls: PlannerTaskList and PowerBIEmbedded.
The PlannerTaskList enables developers to integrate tasks directly in their apps and allow users to interact with the Microsoft Planner tasks. Teams and individuals depend on Microsoft Planner to get organized quickly, work together effortlessly, and stay on the same page.

The PowerBIEmbedded control enables developers to embed a rich PowerBI dashboard directly in their apps and allow users to interact with the rich data directly.
Moved Twitter, LinkedIn, and Microsoft Translator services to .NET Standard
The Windows Community Toolkit contains APIs to make it easy to work with web services such as Twitter, OneDrive, LinkedIn, Microsoft Graph and more. Originally only available to only UWP developers, with this update, most services have moved to our .NET Standard services package (Microsoft.Toolkit.Services). These services are now available to any framework implementing .NET Standard 1.4 and above, which includes UWP, the .NET Framework (including WPF and WinForms), Xamarin, .NET Core and many more.
Get started today
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!
Updated August 8, 2018 8:36 am

Announcing Windows Community Toolkit v3.0 – Windows Developer Blog

I’m excited to announce the largest update to the Windows Community Toolkit yet, version 3.0.As announced a few weeks ago, we recently changed the name of the community toolkit to better align with all Windows developers, and today we are releasing our biggest update yet which introduces:
A new package for WPF and WinForms developers that includes the new Edge WebView
A new package for all XAML UWP developer to enable usage of eye gaze APIs in XAML
A new package for all .NET UWP developers to help in writing runtime API checks
A new package introducing new controls to access the Microsoft Graph
New controls and APIs in existing packages
Fluent updates to existing controls with support for light and dark theme
Updated documentation, including code examples in Visual Basic
Many improvements and bug fixes
Let’s take a look at some of these updates in more details.
A new modern WebView for .NET and WPF apps
Microsoft is bringing the latest Microsoft Edge rendering engine to .NET WinForms and WPF apps. However, working with the WebViewControl and WebView API may feel foreign to native .NET developers, so we’re building additional controls to simplify the experience and provide a more familiar environment. These controls wrap the WebViewControl to enable the control feel more like a native .NET WinForms or WPF control, and provide a subset of the members from that class.

The WinForms and WPF controls are available today in the Microsoft.Toolkit.Win32.UI.Controls package. This means that upgrading from the Trident-powered WebBrowser control to the EdgeHTML-powered WebView in your WinForms or WPF app can be as easy as dragging in a new control from the toolbox.
Visit the docs for the full documentation.
New Gaze Interaction Library to integrate eye gaze in all XAML apps
Gaze input is a powerful way to interact and use Windows and UWP apps that is especially useful as an assistive technology for users with neuro-muscular diseases (such as ALS) and other disabilities involving impaired muscle or nerve functions. The Windows 10 April 2018 Update now includes Windows eye tracking APIs. And to enable developers leveraging those APIs in their XAML apps, we are introducing the Gaze Interaction Library in the Microsoft.Toolkit.Uwp.Input.GazeInteraction package. For example, to enable eye gaze on your xaml page, add the following attached property:

xmlns:gaze=”using:Microsoft.Toolkit.Uwp.Input.GazeInteraction”
gaze:GazeInput.Interaction=”Enabled”

The API allows you to control the customize how the eye gaze works with your UI. Make sure to read this blog to learn more and visit the docs for the full documentation.
Platform Specific Analyzer
When writing platform adaptive code, developers should ensure that code checks for presence of API before calling it. The platform specific analyzer, available through the Microsoft.Toolkit.Uwp.PlatformSpecificAnalyzer nuget package, is a Roslyn analyzer for both C# and Visual Basic that can detect when you are using APIs that might now be available on all versions of Windows 10 and help you add the appropriate code checks.

Just add the nuget package to your app and the analyzer will automatically check your code as you are developing.
Microsoft Graph controls
As part of the new Microsoft.Toolkit.Uwp.UI.Controls.Graph package, we are adding four new controls to enable developers access the Microsoft Graph in their XAML apps.
ProfileCard and AadLogin
The ProfileCard control is a simple way to display a user in multiple different formats using a combination of name, image, and email. The AadLogin control leverages the Microsoft Graph service to enable basic Azure Active Directory (AAD) sign-in process.

PeoplePicker
The PeoplePicker control allows for selection of one ore more users from an organizational AD.
SharePointFileList
The SharePointFileList control allows the user to navigate through a folder and files and displays a simple list of SharePoint files.

New controls and helpers
In addition to the new packages, the toolkit is also adding new controls and helpers to existing packages which are worth mentioning here.
CameraHelper and CameraPreview
The CameraHelper provides helper methods to easily use the available camera frame sources to preview video, capture video frames and software bitmaps. With one line of code, developers can subscribe and get real time video frames and software bitmaps as they arrive from the selected camera source.
The CameraPreview XAML control leverages the CameraHelper to easily preview the video frames in your apps.
In your xaml: