Xamarin.Forms Unit Translation RRS feed

  • Question

  • User356529 posted

    Hi everyone,

    I would like to know what is the unit using in Android and iOS and how to convert it into Xamarin Forms unit. The case is that I get a Android.Graphics.Point and CGPoint for Android and iOS. How can I convert it into System.Drawing.Point in Xamarin Forms with the same unit.

    Thank you. Jimmy

    Friday, January 22, 2021 4:45 PM

All replies

  • User369978 posted

    By default, if you request a width of 400 for something in Xamarin. Xamarin takes that 400 and simply sends it on to the OS. It doesn't append any specific unit. Therefore it will take on dp in Android, and pts in iOS. You should know that 160 dp = 1 inch = 163 pts.

    Refer to https://forums.xamarin.com/discussion/18255/coordinate-units https://forums.xamarin.com/discussion/18670/define-layout-sizes-in-inches-with-idisplay-extension-code-only#latest

    Xamarin forums are migrating to a new home on Microsoft Q&A! We invite you to post new questions in the Xamarin forums’ new home on Microsoft Q&A! For more information, please refer to this sticky post.

    Monday, January 25, 2021 9:44 AM