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 :
The Margin property represents the distance between an element and its adjacent elements, and is used to control the element's rendering position, and the rendering position of its neighbors. Margin values can be specified on layout and view classes.
There is no such built-in property for Frame to set border width. An alternative way is nesting a Frame within another Frame. The following is the demo xaml. You can set the "border width" by setting the property Margin.
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.
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>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With