Search code examples
c#.netwpfnfcproximity

Proximity tap in WPF


I'm trying to detect nearby devices using NFC or RFID from within a WPF application.

Microsoft's proximity API seems to be the right way to go: http://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh465221.aspx

Unfortunately, I see no way to get it running inside a WPF application (or any other Desktop Technology that is). All examples refer to Microsoft store apps only.

From within a WPF application I cannot reference the Namespace

using Windows.Networking.Proximity;

Is it just a reference that I am missing? Is it possible to use the proximity API from a WPF application at all?


Solution

  • I finally found a sample project using the proximity API from within a WPF application: http://code.msdn.microsoft.com/windowsdesktop/NFC-Editor-529ccda6

    There is also a short tutorial included on how to use WinRT API's in WPF applications.

    The basic steps:

    • Manually add a <TargetPlatformVersion>8.0</TargetPlatformVersion> line to the csproj file
    • Back in Visual Studio, add a reference to Windows/Core/Windows to the project references
    • Add a reference to the Windows Runtime assemblies to the project.

    See above given link for details.