HomeWindowsUWP Tips & Tricks #5 – Detect DeviceFamily in Windows App

UWP Tips & Tricks #5 – Detect DeviceFamily in Windows App

Since the Universal Windows Platform (UWP) apps run on all the devices powered by Window 10 , you might sometimes want to target a specific device family(eg : mobile or desktop) for certain features.

How to Detect DeviceFamily in UWP Apps ?

You can use the property VersionInfo.DeviceFamily that is defined in the AnalyticsInfo class as shown below.

var DeviceFamily = Windows.System.Profile.AnalyticsInfo.VersionInfo.DeviceFamily;
MessageDialog dialog = new MessageDialog(DeviceFamily);
dialog.ShowAsync();

When you run your UWP app on a desktop environment and using the Local Machine option for deployment , the device family will be displayed as Windows.Desktop.

image

Leave a Reply

You May Also Like

This blog post will guide you through several effective methods to troubleshoot and resolve the issue of Microsoft Edge not...
Windows 11 offers a range of audio enhancements that can enrich your listening experience. These enhancements include features like virtual...
Windows 11 brings a fresh and visually stunning design to your desktop, and one of the standout features is the...