Oct 16, 2020

Adding rounded corners to controls in Xamarin Forms Application

 To add rounded corners to controls in Xamarin Forms Application add reference to the nuget package "Xamarin.Forms.PancakeView"

add nuget package reference of "Xamarin.Android.Support.Compat" to "Android" project in the solution


in the xaml file for the  ContentPage add following attribute

xmlns:yummy="clr-namespace:Xamarin.Forms.PancakeView;assembly=Xamarin.Forms.PancakeView"


to add rounded corners to the control use two nested pancakeview as follows:

 <yummy:PancakeView BackgroundColor="#374985" CornerRadius="12" Padding="2" Margin="5" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand">
                            <yummy:PancakeView BackgroundColor="White" CornerRadius="10" Padding="2" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand">
                               <!--YOUR CONTAINER CONTROL GOES HERE-->
                            </yummy:PancakeView>
                        </yummy:PancakeView>


output:

No comments:

Post a Comment

Be the first to comment on this post.