Constant

TargetWinUI


Description

Used to indicate that the code has been compiled for Windows using the WinUI controls.

Usage

result = TargetWinUI

Part

Type

Description

result

Boolean

Returns True if you are compiling for Windows using the WinUI controls.

Notes

TargetWinUI indicates that your application was compiled using the WinUI controls. This is True for both 64-bit and 32-bit apps. If you need to detect whether an app is 32-bit or 64-bit, use the appropriate constants: Target32Bit and Target64Bit.

To use WinUI controls, check the Use WinUI checkbox in Build Settings > Windows > Advanced Settings.

Note

While you can use WinUI controls with the DesktopXAMLContainer, this will not result in TargetWinUI returning True.

Sample code

Use this code to follow a different code path when using the WinUI controls:

If TargetWinUI Then
  ' Do some Windows-specific stuff here
End If

This example function can be used to detect if you application is building for a 64-bit version of Windows:

#If TargetWinUI Then
  #If Target64Bit
    ' Building for 64-bit Windows
  #Else
    ' Building for 32-bit Windows
  #Endif
#EndIf

Compatibility

Project Types

All

Operating Systems

All