As @hugo said that the XLabs library is no longer maintained. It may not work with newer versions of Xamarin.Forms. For your requirement, you could use Switch
control to replacing checkbox or use custom checkbox control. The following code implemented a simple checkbox. For more please refer to Introduction to Custom Renderers.
CustomCheckBox.cs
public class CustomCheckBox : View
{
public static readonly BindableProperty CheckedProperty =
BindableProperty.Create("Checked", typeof(bool), typeof(CustomCheckBox), default(bool));
public bool Checked
{
get { return (bool)GetValue(CheckedProperty); }
set { SetValue(CheckedProperty, value); }
}
}
CustomCheckBoxRenderer.cs
[assembly: ExportRenderer(typeof(CustomCheckBox), typeof(CustomCheckBoxRenderer))]
namespace LabsTest.UWP
{
public class CustomCheckBoxRenderer : ViewRenderer<CustomCheckBox, Windows.UI.Xaml.Controls.CheckBox>
{
protected override void OnElementChanged(ElementChangedEventArgs<CustomCheckBox> e)
{
base.OnElementChanged(e);
if (Control == null)
{
SetNativeControl(new Windows.UI.Xaml.Controls.CheckBox());
}
if (Control != null)
{
Control.IsChecked = Element.Checked;
}
}
protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
{
base.OnElementPropertyChanged(sender, e);
if (e.PropertyName == nameof(Element.Checked))
{
UpdateStatus();
}
}
private void UpdateStatus()
{
Control.IsChecked = Element.Checked;
}
}
}
Usage
<StackLayout HorizontalOptions="Center" VerticalOptions="Center">
<local:CustomCheckBox x:Name="MyCheckBox" Checked="True">
</local:CustomCheckBox>
</StackLayout>