public override void ViewDidLoad() { base.ViewDidLoad(); Title = "Binding Example"; // Create a label for the CheckBox. var bemCheckBoxLabel = new UILabel() { Text = "BEMCheckBox:", Frame = new CoreGraphics.CGRect(10, 40, 125, 25) }; // Create the actual checkbox. Remember to pass in the size you want as a CoreGraphics. var checkbox = new BEMCheckBox(new CoreGraphics.CGRect(140, 40, 25, 25)); // Wire up the events. You don't have to do this if you don't care // about the events. An easy way to think of the events is: // // DidTapCheckBox: Before checkbox checked. // AnimationDidStopForCheckBox: After checkbox checked. // // See BEMCheckBox for more details: // // https://github.com/Boris-Em/BEMCheckBox checkbox.DidTapCheckBox += DidTapCheckBoxEvent; checkbox.AnimationDidStopForCheckBox += AnimationDidStopForCheckBoxEvent; // Add the controls to the view. View.AddSubview(bemCheckBoxLabel); View.AddSubview(checkbox); }
public MaterialCheckBox() { Label = new UILabel { Lines = 0, AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth, TranslatesAutoresizingMaskIntoConstraints = false, Font = UIFontExtensions.RobotoMediumOfSize(NormalFontSize), TextColor = NBConfig.PrimaryTextDark, UserInteractionEnabled = true }; AddSubview(Label); Checkbox = new BEMCheckBox(new CGRect(0, 0, 25, 25)) { BoxType = BEMBoxType.Square, OnAnimationType = BEMAnimationType.Fill, OffAnimationType = BEMAnimationType.Fill, OnFillColor = NBConfig.AccentColor, OnTintColor = NBConfig.AccentColor, OnCheckColor = UIColor.White }; AddSubview(Checkbox); var tapGesture = new UITapGestureRecognizer(() => Checkbox.SetOn(!Checkbox.On, true)); Label.AddGestureRecognizer(tapGesture); }
public override void LayoutSubviews() { base.LayoutSubviews(); ; var checkbox = new BEMCheckBox(new CoreGraphics.CGRect(9, 9, 27, 27)); checkbox.OnCheckColor = Color.FromHex("97BD57").ToUIColor(); checkbox.OnTintColor = Color.FromHex("97BD57").ToUIColor(); checkbox.OnAnimationType = BEMAnimationType.Fill; checkbox.OffAnimationType = BEMAnimationType.Fill; checkbox.AnimationDidStopForCheckBox += CheckBoxClickedEvent; //ShopList shop = new ShopList(); //while (shop != null) //{ // if (shop.checker == 0) // { // checkbox.On = false; // } // else // { // checkbox.On = true; // } // shop = null; //} CheckBox.AddSubview(checkbox); MvxFluentBindingDescriptionSet <ShopListViewCell, ShopList> set = new MvxFluentBindingDescriptionSet <ShopListViewCell, ShopList>(this); set.Bind(CheckListItem).To(res => res.Ingredients); set.Apply(); }
public override UIKit.UITableViewCell GetCell(Xamarin.Forms.Cell item, UIKit.UITableViewCell reusableCell, UIKit.UITableView tv) { var tvc = reusableCell as CellTableViewCell; BEMCheckBox bemCheckBox = null; if (tvc == null) { tvc = new CellTableViewCell(UIKit.UITableViewCellStyle.Value1, CellName); } else { bemCheckBox = tvc.AccessoryView as BEMCheckBox; tvc.Cell.PropertyChanged -= OnCellPropertyChanged; } SetRealCell(item, tvc); if (bemCheckBox == null) { bemCheckBox = new BEMCheckBox(Constants.CheckBoxSize); bemCheckBox.ValueChanged += OnCheckBoxValueChanged; tvc.AccessoryView = bemCheckBox; } var boolCell = (CheckBoxCell)item; tvc.Cell = item; tvc.Cell.PropertyChanged += OnCellPropertyChanged; tvc.AccessoryView = bemCheckBox; tvc.TextLabel.Text = boolCell.Text; bemCheckBox.On = boolCell.On; WireUpForceUpdateSizeRequested(item, tvc, tv); UpdateBackground(tvc, item); UpdateIsEnabled(tvc, boolCell); return(tvc); }