public LocationDisplayToggle() { this.InitializeComponent(); try { var compass = Windows.Devices.Sensors.Compass.GetDefault(); if (compass != null) CompassItem.Visibility = Visibility.Visible; } catch { } UpdateIcon(); }