Exemple #1
0
        private void PrepareFormItem(FormItem formItem, object item)
        {
            if (formItem == item)
            {
                return;
            }

            if (item is FrameworkElement)
            {
                return;
            }

            formItem.LabelTemplate = LabelMemberTemplate;
            formItem.Label         = item;
        }
Exemple #2
0
        private void PrepareFormFrameworkElement(FormItem formItem, FrameworkElement content)
        {
            formItem.Label       = GetLabel(content);
            formItem.Description = GetDescription(content);
            formItem.IsRequired  = GetIsRequired(content);
            formItem.ClearValue(DataContextProperty);
            Style style = GetContainerStyle(content);

            if (style != null)
            {
                formItem.Style = style;
            }
            else if (ItemContainerStyle != null)
            {
                formItem.Style = ItemContainerStyle;
            }
            else
            {
                formItem.ClearValue(FrameworkElement.StyleProperty);
            }

            DataTemplate labelTemplate = GetLabelTemplate(content);

            if (labelTemplate != null)
            {
                formItem.LabelTemplate = labelTemplate;
            }

            var binding = new Binding(nameof(Visibility))
            {
                Source = content,
                Mode   = BindingMode.OneWay
            };

            formItem.SetBinding(VisibilityProperty, binding);
        }
Exemple #3
0
        protected override DependencyObject GetContainerForItemOverride()
        {
            var item = new FormItem();

            return(item);
        }