Can I set margin with percentages

Asked by At

I want set Margin with percentages in my code. Im working with Xamarin.Forms (XAML). Thanks a lot for your attention.

I tried things like this: Margin="5*" and Margin="5%" but give me a error.

<Button Text="{Binding Name}"
     TextColor="White"
     ContentLayout="Top"
     BackgroundColor="Transparent"
     BorderColor="White"
     BorderWidth="2"
     CornerRadius="6"
     Margin="5"/>

What im trying to do.

<flv:FlowListView FlowColumnCount="3" SeparatorVisibility="None" HasUnevenRows="true"
                    FlowItemTappedCommand="{Binding ItemTappedCommand}" FlowLastTappedItem="{Binding LastTappedItem}"
                    FlowItemsSource="{Binding MyCategories}" >

                    <flv:FlowListView.FlowColumnTemplate>
                        <DataTemplate>
                            <Button Text="{Binding Name}"
                                TextColor="White"
                                ContentLayout="Top"
                                BackgroundColor="Transparent"
                                BorderColor="White"
                                BorderWidth="2"
                                CornerRadius="6"
                                Margin="5"/>
                        </DataTemplate>
                    </flv:FlowListView.FlowColumnTemplate>

                </flv:FlowListView>

0 Answers