Xamarin.Android | ComponentOne
Controls / Calendar / Quick Start: Display a C1Calendar Control
In This Topic
    Quick Start: Display a C1Calendar Control
    In This Topic

    This section describes how to add a C1Calendar control to your android application and select a date on the calendar at runtime. This topic comprises of two steps:

    The following image shows how C1Calendar appears after completing the above steps.

      

    Step 1: Add a Calendar control

    To add C1Calendar control to your layout, open the .axml file in your layout folder from the Solution Explorer and replace its code with the code below.

    XML
    Copy Code
    <?xml version="1.0" encoding="utf-8"?>
    <C1.Android.Calendar.C1Calendar xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/Calendar" />

    Alternatively, you can drag a C1Calendar control from the Toolbox within the custom control tab onto your layout surface in designer mode.

    Then, inside your activity, add the following code to the OnCreate method to initialize your layout.

    C#
    Copy Code
    protected override void OnCreate(Bundle bundle)
            {
                base.OnCreate(bundle);
                ActionBar.SetDisplayHomeAsUpEnabled(true);
    
                SetContentView(Resource.Layout.GettingStarted);
            }

    Back to Top

    Step 2: Run the project

    Press F5 to run the application.