Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xamarin Forms Margins

I'm trying to find some margins analog in Xamarin.Forms documentation. Does anybody know is there something or paddings is all we are having?

Update: For best understanding of what margin is (it's from MSDN for WPF): enter image description here

like image 242
ad1Dima Avatar asked Jun 04 '14 09:06

ad1Dima


People also ask

How do I set margins in xamarin?

UPD Special for @AUSTX_RJL Margin value is Thickness , just like in any other XAML frameworks. You can set Thickness in XAML by setting one, two or four values separated by comma or whitespace: "1 2 3 4" is same as "1, 2, 3, 4" and sets: 1 for Left. 2 for Top.

What is frame in xamarin forms?

The Xamarin. Forms Frame class is a layout used to wrap a view with a border that can be configured with color, shadow, and other options. Frames are commonly used to create borders around controls but can be used to create more complex UI. For more information, see Advanced Frame usage.

What is StackLayout in xamarin forms?

StackLayout organizes views in a one-dimensional line ("stack"), either horizontally or vertically. Views in a StackLayout can be sized based on the space in the layout, using layout options.


2 Answers

At Last! Xamarin Forms 2.2.0 includes Margins support!

Here are the docs with a great visual. enter image description here

UPD Special for @AUSTX_RJL Margin value is Thickness, just like in any other XAML frameworks.

You can set Thickness in XAML by setting one, two or four values separated by comma or whitespace: "1 2 3 4" is same as "1, 2, 3, 4" and sets:

  • 1 for Left
  • 2 for Top
  • 3 for Right
  • 4 for Bottom

Fields of Thickness

"1 2" sets:

  • 1 for Left and Right fields
  • 2 for Top and Bottom fields

"1" sets 1 for all fields of Thickness

like image 94
ad1Dima Avatar answered Sep 20 '22 14:09

ad1Dima


As of 2014-06-05, there are no margins in Xamarin.Forms. Wrap your content in ContentView, Frame or any other Layout, and use the Padding property.

like image 42
Stephane Delcroix Avatar answered Sep 22 '22 14:09

Stephane Delcroix