Creating A Calender View Control In Xamarin Android App

Introduction

Xamarin is a platform to develop the cross-platform and multi-platform apps. (Ex. Windows phone, Android ,iOS) in Xamarin platform, where the code sharing concept is used. In Xamarin studio, Visual Studio is also available.

Calender View control shows the calender in your app page.

Prerequisites

  • Visual Studio 2015 Update 3 
The following steps are required to be followed in order to create a Calender View control in Xamarin Android app, using Visual Studio 2015 Update 3.

Step 1 - Click File--> select New--> select Project. After clicking the Project, click open all types of projects in Visual Studio.
Or click (Ctrl+Shift+N).

xamarin

Step 2 - After opening New Project, select Installed-->Templates-->Visual C#-->Android-->choose the Blank app (Android). Give your Android app name (Ex:sample) and give the path of your project. Click OK.

xamarin

Step 3 - Go to Solution Explorer. in Solution Explorer, have all the files and source in your project. Select Resource-->Layout-->double click to open main.axml page. Select source to write the XAML code.

To have design, choose the designer Window and you can design your app.

visual studio

Step 4 - After opening main.axml, file will open the main page designer. In this page, you can design the page.

visual studio

Step 5 - Delete the Default hello world button, go to the source panel and you can see the button coding. You need to delete it.

visual studio

Step 6 - After deleting XAML code, delete C# button action code. Go to MainActivity.cs page. You need to delete the button code.

visual studio

Step 7 - After deleting the hello world button code, you will see your app. The button needs to be deleted.

visual studio

Step 8 - Go to the toolbox Window. In the toolbox Window, have all types of the tools and control. You need to go to the toolbox Window. Scroll down and you will see the time and date list, which has Calender View control.

Drag and drop Calender View tool control in your main.axml page.

visual studio

Step 9 - After dragging and dropping of Calender View, your app page will look as given below-

you will trag and trop the calenderview tool control in your main.axml page whatever.

Step 10 - If you have Android virtual device, you can run the virtual device. If you don't have it, run your Android phone.

Connect Android phone via the USB cable in your system or laptop. If you connect Andriod mobile phone, it shows the message: allow USB debugging?.

Always run the app. Click OK button.

Go to Visual Studio.

If you connect your Andriod phone, it will show the run menu (Ex:Sony E6553(Android 6.0-API 23)). It shows the phone in run option. Go to click the connect Android phone and it will run in your Android phone.

you will trag and trop the calenderview tool control in your main.axml page whatever.

Output

In this, app is run, which takes some time because the app will be built in your phone and install an app in your phone.

You will see the output of Calender View in your app.

output

Summary - This was the process to create Calender View control in Xamarin Android app, using Visual Studio 2015 Update 3. 

Up Next
    Ebook Download
    View all
    Learn
    View all