Beispiel #1
0
        internal DescriptorPropertyDefinitionBase(IPropertyParent propertyParent)
        {
            if (propertyParent == null)
            {
                throw new ArgumentNullException("propertyParent");
            }

            _propertyParent = propertyParent;
        }
Beispiel #2
0
        internal static PropertyItem CreatePropertyItem(PropertyDescriptor property, IPropertyParent propertyParent)
        {
            DescriptorPropertyDefinition definition = new DescriptorPropertyDefinition(property, propertyParent);

            definition.InitProperties();
            PropertyItem propertyItem = new PropertyItem();

            propertyItem.PropertyDescriptor = property;
            propertyItem.Instance           = propertyParent.ValueInstance;
            PropertyGridUtilities.InitializePropertyItem(propertyItem, definition);
            return(propertyItem);
        }
        internal DescriptorPropertyDefinition(PropertyDescriptor propertyDescriptor, IPropertyParent propertyParent)
            : base(propertyParent)
        {
            if (propertyDescriptor == null)
            {
                throw new ArgumentNullException("propertyDescriptor");
            }

            _propertyDescriptor = propertyDescriptor;
            _dpDescriptor       = DependencyPropertyDescriptor.FromProperty(propertyDescriptor);
            _markupObject       = MarkupWriter.GetMarkupObjectFor(_propertyParent.ValueInstance);
        }
        //*
#if false//*/
        private bool VerifyAttributeType()
        {
            if (this.type is ICliType)
            {
                if (this.type is ICreatableParent)
                {
                    if (this.parameters != null)
                    {
                        if (this.Parameters.Any(q => q is IMetadatumDefinitionNamedParameter))
                        {
                            if (!(this.type is IPropertyParent))
                            {
                                return(false);
                            }
                            else
                            {
                                IEnumerable <IMetadatumDefinitionNamedParameter> namedParameters =
                                    from p in this.Parameters
                                    where p is IMetadatumDefinitionNamedParameter
                                    select(IMetadatumDefinitionNamedParameter) p;

                                IPropertyParent propertyParent = ((IPropertyParent)(this.type));
                                foreach (var propertyValue in namedParameters)
                                {
                                    if (!propertyParent.Properties.ContainsKey(propertyValue.Name))
                                    {
                                        return(false);
                                    }
                                }
                            }
                        }
                    }
                    IEnumerable <IType> ctorSignature = null;
                    if (parameters != null)
                    {
                        ctorSignature =
                            from r in this.Parameters
                            where !(r is IMetadatumDefinitionNamedParameter)
                            select r.ParameterType;
                    }
                    else
                    {
                        ctorSignature = TypeCollection.Empty;
                    }
                    ICreatableParent creatableParent = (ICreatableParent)this.type;
                    if (creatableParent.Constructors.Find(false, ctorSignature.ToCollection()).Count == 0)
                    {
                        return(false);
                    }
                }
                else
                {
                    return(false);
                }
                return(true);
            }
            else if (this.type is IIntermediateClassType)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }