Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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);
        }