Skip to content
Steven Thewissen edited this page May 31, 2020 · 2 revisions

How to use it?

The project is up on NuGet and you can find it by searching for Xamarin.Forms.PancakeView. You could also simply clone the repository and include the projects in the src folder in your Xamarin.Forms and Platform projects. It uses multi-targeting to resolve to the correct platform.

The first thing we need to do to get started is tell our XAML page where it can find the PancakeView, which is done by adding the following attribute to our ContentPage:

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"  xmlns:yummy="clr-namespace:Xamarin.Forms.PancakeView;assembly=Xamarin.Forms.PancakeView">
   ...
</ContentPage>

Next up, just smack a PancakeView onto that page and you're all set, simple as baking real pancakes!

<yummy:PancakeView BackgroundColor="#bc91d7" CornerRadius="60,0,0,60" HorizontalOptions="FillAndExpand" HeightRequest="150">
   <Image Source="unicorn.png" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" Aspect="AspectFill" />
</yummy:PancakeView>

Additional setup for UWP

PancakeView supports calling an Init() method to prevent the linker from stripping it out of your code that you can call in each platform's initializer. However, for UWP this might not be enough. When the .NET Native tool chain is used (e.g., to submit to the Microsoft Store), the renderer could go missing. To prevent this from happening, replace the Init() call in your App.xaml.cs file with the following:

List assembliesToInclude = new List();
assembliesToInclude.Add(typeof(Xamarin.Forms.PancakeView.UWP.PancakeViewRenderer).GetTypeInfo().Assembly);
Xamarin.Forms.Forms.Init(e, assembliesToInclude);

Additional setup for WPF

You need to call PancakeViewRenderer.Init() in MainWindow

 InitializeComponent();
 Forms.Init();

 // Init pancakes
 PancakeViewRenderer.Init();

 LoadApplication(new PancakeViewSample.App());
Clone this wiki locally