Xuni Controls > Calendar > Quick Start: Display a Xuni Calendar Control |
This section describes how to add a Xuni Calendar 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 the Xuni Calendar appears after completing the above steps.
Complete the following steps to initialize a Calendar control in C# or XAML.
C# |
Copy Code |
---|---|
using Xamarin.Forms; using Xuni.Forms.Calendar; |
C# |
Copy Code |
---|---|
public static XuniCalendar ReturnMyControl() { XuniCalendar calendar = new XuniCalendar(); calendar.MaxSelectionCount = -1; calendar.HorizontalOptions = Xamarin.Forms.LayoutOptions.Center; calendar.FontSize = 30; return calendar; } |
XAML |
Copy Code |
---|---|
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:xuni="clr-namespace:Xuni.Forms.Calendar;assembly=Xuni.Forms.Calendar" x:Class="CalendarQuickStart.QuickStart" Padding="20"> |
XAML |
Copy Code |
---|---|
<Grid> <Label Text="{Binding MainText}" HorizontalOptions="Center" Font="Large" /> <xuni:XuniCalendar x:Name="calendar" MaxSelectionCount="-1" /> </Grid> </ContentPage> |
C# |
Copy Code |
---|---|
public App() { // The root page of your application MainPage = new ContentPage { Content = QuickStart.ReturnMyControl() }; } |
C# |
Copy Code |
---|---|
public App() { // The root page of your application MainPage = new QuickStart(); } |
C# |
Copy Code |
---|---|
Xuni.Forms.Calendar.Platform.iOS.Forms.Init(); |
C# |
Copy Code |
---|---|
Xuni.Forms.Calendar.Platform.WinPhone.XuniCalendarRenderer.Init(); |