Windows Phone 8.1 and Windows Runtime Apps How to #6 – How to Detect the Current device Platform in Windows Universal App ?

When working with the Windows Universal App , it may be necessary for the developers sometimes to check if the target device is phone or windows 8 tablet and write the platform dependent code based on the criteria.

How to Detect the Current device Platform in Windows Universal App ?

You can use the #ifdef directives WINDOWS_APP and WINDOWS_PHONE_APP for this scenario.

Eg :

    // Its a Windows Phone app
    // Its a Windows 8 app