Xamarin Units for Margins and Widths

273 Views Asked by At

I'm trying to make sense of Xamarin margins and widths. Supposedly Xamarin uses DIP.

My UX person uses Invision for her designs. When I set Invision to show me DIP, I get a measure of 122 from left margin to Title

enter image description here

and 90 from label above

enter image description here

Yet, in Xamarin I have to specify 78 for the left width and 75 for the top margin for them to match the design. Used the edge of an envelope to confirm.

        <Frame Grid.Column="0" Grid.RowSpan="5" WidthRequest="78"/>

        <Label Text="Title" Grid.Row="0" Grid.Column="1" FontSize="22" Margin="0,75,0,0"/>

None of the Invision choices, Pixels, Points or DIP come close to the values that trial and error ended up with. I'm running the app in UWP. My values work great on 1366x768 and 1680x1050 displays.

1

There are 1 best solutions below

1
Visual Sharp On BEST ANSWER
  • Frame has a default padding of 20
  • Grid has a default has RowSpacings & ColumnSpacing of 6
  • Stacklayout has a default Spacing of 6

Try play around with these parents value or set them to 0, because they have default values. Look like you have one of those: Eg: 90 - 2*6 = 78