public static List <IModelProperty> GetModelPropertys(DependencyObject obj)
        {
            if (obj == null)
            {
                return(new List <IModelProperty>());
            }
            DesignAttributeService service = TryGetService(obj);

            if (service == null)
            {
                return(new List <IModelProperty>());
            }
            var result = service._ModelPropertyList.Select(x =>
            {
                var pro = new ModelPropertyImpl();
                pro.CopyFrom(x);
                pro.Owner = obj;
                if (pro.Binding != null)
                {
                    pro.Binding.Source = obj;
                }
                return((IModelProperty)pro);
            }).ToList();

            IDesignerChildable childable = obj as IDesignerChildable;

            if (childable != null)
            {
                result.AddRange(GetModelPropertys(childable.DesignerChild));
            }
            return(result);
        }
        private IEnumerable <IModelProperty> GetModelPropertyList()
        {
            var result = new List <IModelProperty>();

            if (_type == null)
            {
                return(result);
            }

            _type.EnumerateAttributes <DataModelFieldAttribute, string>(attribute =>
            {
                if (string.IsNullOrWhiteSpace(attribute.DisplayName))
                {
                    attribute.DisplayName = attribute.FieldName;
                }
                if (string.IsNullOrWhiteSpace(attribute.FieldName))
                {
                    attribute.FieldName = attribute.DisplayName;
                }
                PropertyDescriptor pro = null;
                if (attribute.BindPath != null)
                {
                    pro = TryToGetDependencyProperty(_type, attribute.BindPath) ?? _properties[attribute.BindPath];
                }
                var mpi = ModelPropertyImpl.Create(_type, pro, attribute.DisplayName, attribute.FieldName, attribute.BindPath, attribute.TargetGroup);
                //mpi.UnitMark = attribute.UnitMark;
                result.Add(mpi);
            }, x => x.FieldName);
            _type.EnumeratePropertiesAttributes <DataModelFieldAttribute>((descriptor, attribute) =>
            {
                if (descriptor.SupportsChangeEvents)
                {
                    descriptor = TryToGetDependencyProperty(descriptor.ComponentType, descriptor.Name) ?? descriptor;
                }
                var displayName = descriptor.DisplayName;
                if (string.IsNullOrWhiteSpace(displayName))
                {
                    displayName = descriptor.Name;
                }
                if (string.IsNullOrWhiteSpace(attribute.FieldName))
                {
                    attribute.FieldName = displayName;
                }
                var mpi = ModelPropertyImpl.Create(_type, descriptor, displayName, attribute.FieldName, descriptor.Name, attribute.TargetGroup);
                //mpi.UnitMark = attribute.UnitMark;
                result.Add(mpi);
            });

            return(result);
        }