public void AddValueCell(string title, Binding.BindingHost bindingHost, string bindingValuePropertyName, Func <object, string> converter, Action invokeAction) { var cell = new UITableViewCell(UITableViewCellStyle.Value1, "Value1Cell"); cell.TextLabel.Text = title; bindingHost.SetLabelTextBinding(cell.DetailTextLabel, bindingValuePropertyName, converter: converter); AddCell(cell, invokeAction); }
public void AddTextFieldCell(string title, Binding.BindingHost bindingHost, string bindingValuePropertyName, Action <BareUITextField> customizeTextField = null) { var cell = new BareUITableViewCellWithTextField(UITableViewCellStyle.Value1); cell.TextLabel.Text = title; bindingHost.SetTextFieldBinding(cell.TextField, bindingValuePropertyName); customizeTextField?.Invoke(cell.TextField); }
public static void AddUnderLazyVisibility(this UIStackView stackView, Binding.BindingHost bindingHost, string propertyName, Func <UIView> createView) { BareUIVisibilityContainer container = new BareUIVisibilityContainer() { TranslatesAutoresizingMaskIntoConstraints = false }; bindingHost.SetBinding <bool>(propertyName, (isVisible) => { if (isVisible && container.Child == null) { container.Child = createView(); } }); bindingHost.SetVisibilityBinding(container, propertyName); stackView.AddArrangedSubview(container); container.StretchWidth(stackView); }
public static void AddUnderVisiblity(this UIStackView stackView, UIView view, Binding.BindingHost bindingHost, string propertyName, bool invert = false) { BareUIVisibilityContainer container = new BareUIVisibilityContainer() { TranslatesAutoresizingMaskIntoConstraints = false, Child = view }; bindingHost.SetVisibilityBinding(container, propertyName, invert); stackView.AddArrangedSubview(container); container.StretchWidth(stackView); }
/// <summary> /// Two-way binding /// </summary> /// <param name="title"></param> /// <param name="description"></param> /// <param name="bindingHost"></param> /// <param name="bindingValuePropertyName"></param> public void AddCheckableCellWithDescription(string title, string description, Binding.BindingHost bindingHost, string bindingValuePropertyName) { var cell = new UITableViewCell(UITableViewCellStyle.Subtitle, "CheckableDescriptionCell"); cell.TextLabel.Text = title; cell.DetailTextLabel.Text = description; cell.DetailTextLabel.Lines = 0; bindingHost.SetIsCheckedBinding(cell, bindingValuePropertyName); AddCell(cell, delegate { try { var type = bindingHost.DataContext.GetType(); var prop = type.GetProperty(bindingValuePropertyName); prop.SetValue(bindingHost.DataContext, true); } catch { } }); }