Reputation: 1020
I have an image on my Xamarin.Forms. I want to add some margin from Top.
Form.XAML:-
<ContentPage.Content>
<Grid>
<Image x:Name="image" />
</Grid>
</ContentPage.Content>"
Form.XAML.cs:-
image.Source = ImageSource.FromFile (Height > Width ? "portrait.jpg" : "landscape.jpg");
Upvotes: 2
Views: 8256
Reputation: 2296
The current stable version of Xamarin.Forms, 2.2.0.31 supports the Margin property. It accepts a "Thickness" object which specifies the left, top, right and bottom sizes you want.
In XAML, the standard value converter is applied, which means you can specify Margin as one of these:
More documentation is available here Margins and Padding
Upvotes: 10