SYSK 397: Xamarin-Forms-Labs CalendarView control is not rendered in Win8 phone

If you downloaded XLabs open source controls from https://github.com/XLabs/Xamarin-Forms-Labs and trying to use them in a Xamarin project targeting Windows phone 8, you may be having "blank" rendering (calendar not displayed) issue - note that the space for the control is taken which can be seen by setting control's background property.  I had this issue attempting to use Calendar control using XLabs.Forms.WP8, Version=2.0.5782.12223 version. 

I believe the issue is in the fact that that assembly targets WinPhone 8.1 --  [assembly: TargetFramework("WindowsPhone,Version=v8.1", FrameworkDisplayName = "Windows Phone 8.1")].  If your project is targeting WinPhone 8.0 (and not 8.1), the XLabs.Forms.WP8.dll is not deployed even if it is referenced.  That means that there is no associated renderer for the Calendar control.

One way to work around the issue is to add your own renderer for it in .WinPhone project, e.g.:

[assembly: ExportRenderer(typeof(XLabs.Forms.Controls.CalendarView), typeof(YourNamespace.CalendarViewRenderer))]

public class CalendarViewRenderer : ViewRenderer<CalendarView, Calendar>
{
    Calendar calendar = null;

    public CalendarViewRenderer() : base()
    {
        calendar = new Calendar();
        calendar.DateClicked += Calendar_DateClicked;           
    }
     
    protected override void OnElementChanged(ElementChangedEventArgs<CalendarView> e)
    {
        base.SetNativeControl(calendar);
        base.OnElementChanged(e);                       
    }

    private void Calendar_DateClicked(object sender, WPControls.SelectionChangedEventArgs e)
    {
        base.Element.NotifyDateSelected(e.SelectedDate);
    }
}