private void PrepareFormItem(FormItem formItem, object item) { if (formItem == item) { return; } if (item is FrameworkElement) { return; } formItem.LabelTemplate = LabelMemberTemplate; formItem.Label = item; }
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); }
protected override DependencyObject GetContainerForItemOverride() { var item = new FormItem(); return(item); }