我在 Xamarin Studio 的 XLabs Nuget 包中使用 Xamarin Forms 中的 CalendarView 控件。
CalendarView 定义如下,但在 android 设备上没有显示日历:
using System;
using Xamarin.Forms;
using XLabs.Forms.Controls;
namespace CustomRenderer
{
public class MyPage : ContentPage
{
public MyPage()
{
CalendarView calendarView = new XLabs.Forms.Controls.CalendarView
{
MinDate = new DateTime(2016, 1,1),
MaxDate = new DateTime(2016, 1, 31),
VerticalOptions = LayoutOptions.FillAndExpand,
HorizontalOptions = LayoutOptions.FillAndExpand,
ShowNavigationArrows = true,
DateBackgroundColor = Color.White,
IsVisible = true,
};
calendarView.DateSelected += (object sender, DateTime e) => {
};
Content = new StackLayout
{
HeightRequest = 400,
WidthRequest = 320,
Children =
{
calendarView
}
};
}
}
}