/// <summary> /// Creates the content control for the cell. /// </summary> /// <remarks> /// The control returned may be reused for other cells, so it is ideal to use MVVM data binding using /// BindDataContext() /// methods of your controls. /// This should return the same control for each row, otherwise the incorrect control may be shown on certain cells. /// </remarks> /// <param name="args">Cell arguments.</param> public override Control OnCreate(CellEventArgs args) { if (ItemBinding == null) { return(null); } var checkBox = new CheckBox(); checkBox.CheckedBinding.BindDataContext(ItemBinding); if (ItemThreeStateBinding != null) { checkBox.BindDataContext(c => c.ThreeState, ItemThreeStateBinding); } var label = new Label { Wrap = WrapMode.None, VerticalAlignment = VerticalAlignment.Center }; label.MouseDoubleClick += (sender, e) => checkBox.Checked = !checkBox.Checked; label.Bind(c => c.TextColor, args, a => a.CellTextColor); label.TextBinding.Bind(checkBox, Binding.Property((CheckBox c) => c.Checked).Convert(r => Convert.ToString(r))); return(new TableLayout { Spacing = new Size(5, 0), Rows = { new TableRow(new TableCell(label, true), checkBox) } }); }