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); }
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); }