Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

How to apply a margin on a Xamarin.Forms control?

$
0
0

We've tried this very simple approach:

<?xml version="1.0" encoding="UTF-8"?>
<Button xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="Klaim.ButtonView"
             BackgroundColor="#f04e23"
             TextColor="#ffffff"
             Margin="10, 10, 10, 10" />

But the compiler doesn't like it. It seems like a trivial issue and it's probably something very easy to implement, but we can't for the love of insert_deity_here find the clean way to do it.

We know that we can apply a "Thickness" to a contentpage as shown below, but I believe this is padding, not margin:

<ContentPage.Padding>
        <OnPlatform x:TypeArguments="Thickness"
                    iOS="20, 40, 20, 20"
                    Android="20, 20, 20, 20"
                    WinPhone="20, 20, 20, 20" />
    </ContentPage.Padding>

Could the solution be a similar snippet but for the button? (The same issue applies to Entry)


Viewing all articles
Browse latest Browse all 58056

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>