Srusti Thakkar
Srusti Thakkar

Reputation: 1901

How to set Frame Margin in xamarin?

I am creating Listview using custom cell. I am using Frame inside the Viewcell. It displays fine in Android device, but in IOS it doesn't display Margins between two Frames. How can I set this for IOS?

Code of Viewcell is:

 <ViewCell>
    <StackLayout>
      <Frame Margin="10" BackgroundColor="White" CornerRadius="5" HasShadow="False"  IsClippedToBounds="False">
       <StackLayout>
          <Label Text="{Binding Name}" FontFamily="Raleway-Regular" FontSize="24" TextColor="#262628" HorizontalTextAlignment="Center" FontAttributes="Bold"></Label>
          <Label Text="{Binding Description1}" FontSize="15" HorizontalTextAlignment="Center" TextColor="#262628" FontAttributes="Bold" Margin="0,5"></Label>
          <ContentView HorizontalOptions="Center"  Padding="0" Content="{Binding IngredientsArray1, Converter={StaticResource arrayToStackLayout}}" />
       </StackLayout>
      </Frame>
     </StackLayout>
 </ViewCell>

IOS Output is :

image

Upvotes: 6

Views: 3021

Answers (1)

Srusti Thakkar
Srusti Thakkar

Reputation: 1901

I have just Changed My code From above to this:

 <ViewCell>
                <ContentView>
                    <Frame Margin="10" BackgroundColor="White" CornerRadius="5" HasShadow="False"  IsClippedToBounds="True">
                        <StackLayout Margin="5">
                            <Label Text="{Binding Name}" FontFamily="Raleway-Bold" FontSize="24" TextColor="#262628" HorizontalTextAlignment="Center" FontAttributes="Bold"></Label>
                            <Label Text="{Binding Description1}" FontSize="15" HorizontalTextAlignment="Center" TextColor="#262628" FontAttributes="Bold" Margin="0,5"></Label>
                            <ContentView HorizontalOptions="Center"  Padding="0" Content="{Binding IngredientsArray1, Converter={StaticResource arrayToStackLayout}}" />
                        </StackLayout>
                    </Frame>
                </ContentView>
            </ViewCell>

Upvotes: 3

Related Questions