Forum Xamarin.Forms
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

How to Make Compass Point to 258.5 degree?

JassimRahmaJassimRahma USMember ✭✭✭✭

Hi,

How can I make the Xamarin Essentials Compass to always point at 258.5 degree?

Thanks,
Jassim

Answers

  • ColeXColeX Member, Xamarin Team Xamurai

    Compass class is used to monitor the device's magnetic north heading , the degree value is determine by device direction , ,what's the scenario do you want to control the degree ?

  • JassimRahmaJassimRahma USMember ✭✭✭✭

    Yes, I want to point the compass to a specific degree

    I am getting the degree through a formula, let's say result is 280.5 so I want the compass to always point o 280.5 as an example

  • suraj007suraj007 Member ✭✭✭

    void Compass_ReadingChanged(object sender, CompassChangedEventArgs e)
    {
    Heading = 280.5;
    HeadingDisplay = $"Heading: {Heading.ToString()}";
    }

  • suraj007suraj007 Member ✭✭✭

    https://github.com/jamesmontemagno/app-compass
    ///replace code in MyCompassViewModel
    void Compass_ReadingChanged(object sender, CompassChangedEventArgs e)
    {
    Heading = 280.5;
    HeadingDisplay = $"Heading: {Heading.ToString()}";
    }

Sign In or Register to comment.