Over the course of time I received a number of comments on my blog in this area. Many questions were asked like “Can you use WinRT from Desktop applications?”, “Can you use WinRT from .NET applications?”, etc..
Well, the answer is YES. It is possible to use WinRT from Desktop applications. WinRT APIs may be tied to Metro style apps, Desktop apps or potentially available to both. The documentation will list which environments (Desktop, Metro style or both) a given API works in.
Note: Custom WinRT components are only supported in Metro style applications. They are not supported in Desktop applications.
For ex, WinRT has an API for Accelerometer. The Accelerometer class represents an accelerometer sensor which returns G-force values with respect to the x, y, and z axes.
Namespace: Windows.Devices.Sensors namespace
If we open the API documentation at
, see the section Applies to: Metro style apps | desktop apps. Which means this class works in Metro Apps as well as desktop apps.
Figure 1: MSDN documentation showing WinRT API and it’s applies to section.