Custom Content Page Using Xamarin.Forms


Xamarin is a platform that allows us to create multi-platform mobile applications, like Windows phone, Apple iOS, and Android through a single integrated development environment (IDE). This platform allows the designers to develop and design various mobile platform applications very rapidly. In this article, we will discuss how to create CustomContentPage using Xamarin.Forms (or) cross-platform from VS 2017. There are many plugins available for Xamarin.Forms including Stack Layout, Label, and button.


  1. Windows 10 (Recommended)
  2. Visual Studio 2017 Community/Enterprise/Professional Edition (Software available online at

The steps given below need to be followed in order to design CustomContentPage and Entry concept View in Xamarin.Form, using Microsoft Visual Studio 2017.


Step 1

Go to Visual Studio 2017.

Click File —> New —> Project or shortcuts (Ctrl+Shift+N).


Step 2

Go to Visual C# --> Cross Platform –> Blank App (Xamarin.Form or native); change your application name and click the "OK" button.


Step 3

After this, go to the new cross platform app. Select a Blank App, Xamarin.Forms as UI technology and PCL as code sharing strategy. Now, click the “OK” button.


Step 4

In this step, go to select (Portable) page, double click on HomePage.XAML, wait for a few seconds and it will execute the main XAML page.


Step 5

Then, a single layout is added to some color changes. I have given the source code; you can use this code or create your own code.



  1. <?xml version="1.0" encoding="utf-8" ?>  
  2. <ContentPage xmlns="" xmlns:x="" x:Class="CustomContentPage.HomePage">  
  3.     <Label Text="Xamarin.FormApplication But color change seperate Platform" TextColor="Black" FontSize="40" VerticalOptions="Center" HorizontalOptions="Center" />   
  4. </ContentPage>  
Step 6 

In this step, right click on Droid Page and select Add>> New item or  use "Ctrl+Shift+A" shortcut.


Step 7

Add a new item, select Installed >> Visual C# >> Class . Here, you can change the name but the default name is using a calling function.


Step 8

In this step, on the Android page, please write some query. I have given source code; you can use this code or you can own code.



  1. using System;  
  2. using System.Collections.Generic;  
  3. using System.Linq;  
  4. using System.Text;  
  5. using Android.App;  
  6. using Android.Content;  
  7. using Android.OS;  
  8. using Android.Runtime;  
  9. using Android.Views;  
  10. using Android.Widget;  
  11. using Xamarin.Forms;  
  12. using CustomContentPage;  
  13. using CustomContentPage.Droid;  
  14. using Xamarin.Forms.Platform.Android;  
  15. [assembly: ExportRenderer(typeof(HomePage), typeof(HomePageRenderer))]  
  16. namespace CustomContentPage.Droid {  
  17.     public class HomePageRenderer: PageRenderer {  
  18.         protected override void OnElementChanged(ElementChangedEventArgs < Page > e) {  
  19.             base.OnElementChanged(e);  
  20.             this.SetBackgroundColor(global::Android.Graphics.Color.Green);  
  21.         }  
  22.     }  
  23. }  
Step 9 

Similarly, right click on Windows or (UWP) page and  select Add >> New item or (Ctrl+Shift+A) shortcut.



Step 11



  1. using CustomContentPage;  
  2. using CustomContentPage.UWP;  
  3. using System;  
  4. using System.Collections.Generic;  
  5. using System.Linq;  
  6. using System.Text;  
  7. using System.Threading.Tasks;  
  8. using Xamarin.Forms.Platform.UWP;  
  9. using Xamarin.Forms;  
  10. using Windows.UI.Xaml.Media;  
  11. using Windows.UI;  
  12. [assembly: ExportRenderer(typeof(HomePage), typeof(HomePageRenderer))]  
  13. namespace CustomContentPage.UWP {  
  14.     public class HomePageRenderer: PageRenderer {  
  15.         protected override void OnElementChanged(ElementChangedEventArgs < Page > e) {  
  16.             base.OnElementChanged(e);  
  17.             this.Background = new SolidColorBrush(Colors.Yellow);  
  18.         }  
  19.     }  
Step 12 

Then, double click on the App.cs page where a simple code will be written to call the main page. In this application, the main page is Homepage.xaml.


Step 13

Right click on project name in Solution Explorer and select "Set Startup Projects".


Step 14

After a few seconds, the solution page will appear with default single startup project but we can change to multiple startup projects. Then, start by clicking on the Droid and UWP pages. Finally, click the “OK” button.


Step 15

Platform will offer multiple deploy options. We can select the Emulator as per our choice. 





In this article, you learned how to create the CutomeConetnPage using Xamarin.Forms with .NET Standard libraries. If you have any questions/ feedback/ issues, please write in the comment box.

Up Next
    Ebook Download
    View all
    View all