A Nuget Package for Xamarin Forms. Interactive Xamarin Forms Calendar https://www.nuget.org/packages/ModernXamarinCalendar/
Install the Nuget Package using Nuget Package Manager or in the Package Manager Console run command:
Install-Package ModernXamarinCalendar -Version 1.0.4
In the XAML content page where you would like the Calendar to go (such as
MainPage.xaml
), write within the Content Page Tag
xmlns:control="clr-namespace:ModernXamarinCalendar;assembly=ModernXamarinCalendar"
Within your layout in the same XAML Page, place
<control:WeekControl x:Name="CalendarWeekControl"
HorizontalOptions="CenterAndExpand"
BackgroundColor="SteelBlue" />
In the C# code for your content page (such as MainPage.xaml.cs
)
public void SelectedDateChanged(object sender, EventArgs e)
{
var calendar = sender as WeekControl;
// Insert code here that you want to use the date selected for...
// control.SelectedDate returns a DateTime for the selected day.
Debug.WriteLine(calendar.SelectedDate.ToString());
}
In the same C# file, write within the constructor
CalendarWeekControl.SelectedDateChanged += SelectedDateChanged;
Download Images from
GitHub - Images - Download this folder for icons for the nuget package
and install them in your project
In the XAML page, set this property for the WeekControl
:
ShowDayName="True"
or in the C# code:
CalendarWeekControl.ShowDayName = true;
(The default value for ShowDayName
is false, so not specifying it means the
days will not show up).
In the XAML page, set this property for the WeekControl:
ForegroundColor="White"
(The default value for ForegroundColor
is Black).