CompassReading CompassReading CompassReading CompassReading CompassReading Class


Represents a compass reading.

public : sealed class CompassReading : ICompassReading, ICompassReadingHeadingAccuracy
struct winrt::Windows::Devices::Sensors::CompassReading : ICompassReading, ICompassReadingHeadingAccuracy
public sealed class CompassReading : ICompassReading, ICompassReadingHeadingAccuracy
Public NotInheritable Class CompassReading Implements ICompassReading, ICompassReadingHeadingAccuracy
// This class does not provide a public constructor.
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)


This object is accessed when you invoke the GetCurrentReading method; and, it is accessed when you retrieve the Reading property of the CompassReadingChangedEventArgs object in the event callback method.


HeadingAccuracy HeadingAccuracy HeadingAccuracy HeadingAccuracy HeadingAccuracy

Gets the compass's heading accuracy.

public : MagnetometerAccuracy HeadingAccuracy { get; }
MagnetometerAccuracy HeadingAccuracy();
public MagnetometerAccuracy HeadingAccuracy { get; }
Public ReadOnly Property HeadingAccuracy As MagnetometerAccuracy
var magnetometerAccuracy = compassReading.headingAccuracy;
MagnetometerAccuracy MagnetometerAccuracy MagnetometerAccuracy

The compass's heading accuracy.

HeadingMagneticNorth HeadingMagneticNorth HeadingMagneticNorth HeadingMagneticNorth HeadingMagneticNorth

Gets the heading in degrees relative to magnetic-north.

public : double HeadingMagneticNorth { get; }
double HeadingMagneticNorth();
public double HeadingMagneticNorth { get; }
Public ReadOnly Property HeadingMagneticNorth As double
var double = compassReading.headingMagneticNorth;
double double double

The magnetic-north heading.

HeadingTrueNorth HeadingTrueNorth HeadingTrueNorth HeadingTrueNorth HeadingTrueNorth

Gets the heading in degrees relative to geographic true-north.

public : IReference<double> HeadingTrueNorth { get; }
IReference<double> HeadingTrueNorth();
public Nullable<double> HeadingTrueNorth { get; }
Public ReadOnly Property HeadingTrueNorth As Nullable<double>
var nullable = compassReading.headingTrueNorth;
Nullable<double> Nullable<double> Nullable<double>

The true-north heading.


Before retrieving this property, your code should first check to verify that the value is not null. (If the value is null and you attempt to retrieve it, Windows will generate an exception.)

In order to retrieve the declination, your app needs to have access to the device's current location. If the location is not available, the declination defaults to 0 degrees. In this scenario, HeadingTrueNorth equals HeadingMagneticNorth.

PerformanceCount PerformanceCount PerformanceCount PerformanceCount PerformanceCount

Gets the performance count associated with the reading. This allows the reading to be synchronized with other devices and processes on the system.

public : IReference<TimeSpan> PerformanceCount { get; }
IReference<TimeSpan> PerformanceCount();
public Nullable<TimeSpan> PerformanceCount { get; }
Public ReadOnly Property PerformanceCount As Nullable<TimeSpan>
var nullable = compassReading.performanceCount;
Nullable<TimeSpan> Nullable<TimeSpan> Nullable<TimeSpan>

The performance count for the reading. Null if this property is not supported on the sensor.

Additional features and requirements
Device family
Windows 10 Fall Creators Update (introduced v10.0.16299.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v5)

Properties Properties Properties Properties Properties

Gets the data properties reported by the sensor.

public : IMapView<Platform::String, Platform::Object> Properties { get; }
IMapView<winrt::hstring, winrt::Windows::Foundation::IInspectable> Properties();
public IReadOnlyDictionary<string, object> Properties { get; }
Public ReadOnly Property Properties As IReadOnlyDictionary<string, object>
var iReadOnlyDictionary =;
IReadOnlyDictionary<string, object> IReadOnlyDictionary<string, object> IReadOnlyDictionary<string, object>

Contains a key/value pair for each data property reported by the sensor for the given reading. The key is a string of the property key, and the value is the value of the property that the key represents.

Additional features and requirements
Device family
Windows 10 Fall Creators Update (introduced v10.0.16299.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v5)

Timestamp Timestamp Timestamp Timestamp Timestamp

Gets the time at which the sensor reported the reading.

public : DateTime Timestamp { get; }
DateTime Timestamp();
public DateTimeOffset Timestamp { get; }
Public ReadOnly Property Timestamp As DateTimeOffset
var dateTimeOffset = compassReading.timestamp;
DateTimeOffset DateTimeOffset DateTimeOffset

The time at which the sensor reported the reading.

See Also