Exemple #1
0
            internal PropertyDescriptor GetDefaultProperty(object instance)
            {
                AttributeCollection attributes;

                if (instance != null)
                {
                    attributes = TypeDescriptor.GetAttributes(instance);
                }
                else
                {
                    attributes = TypeDescriptor.GetAttributes(_type);
                }

                DefaultPropertyAttribute attr = (DefaultPropertyAttribute)attributes[typeof(DefaultPropertyAttribute)];

                if (attr != null && attr.Name != null)
                {
                    if (instance != null)
                    {
                        return(TypeDescriptor.GetProperties(instance)[attr.Name]);
                    }
                    else
                    {
                        return(TypeDescriptor.GetProperties(_type)[attr.Name]);
                    }
                }

                return(null);
            }
		public bool FilterAttributes (IComponent component,IDictionary attributes)
		{
			Attribute ea = new DefaultEventAttribute ("AnEvent");
			attributes [ea.TypeId] = ea;
			ea = new DefaultPropertyAttribute ("TestProperty");
			attributes [ea.TypeId] = ea;
			ea = new EditorAttribute ();
			attributes [ea.TypeId] = ea;
			return true;
		}
Exemple #3
0
        public PropertyDescriptor GetDefaultProperty()
        {
            if (this._gotDefaultProperty)
            {
                return(this._defaultProperty);
            }
            DefaultPropertyAttribute defaultPropertyAttribute = (DefaultPropertyAttribute)this.GetAttributes()[typeof(DefaultPropertyAttribute)];

            if (defaultPropertyAttribute == null || defaultPropertyAttribute.Name == null)
            {
                this._defaultProperty = null;
            }
            else
            {
                PropertyDescriptorCollection properties = this.GetProperties();
                this._defaultProperty = properties[defaultPropertyAttribute.Name];
            }
            this._gotDefaultProperty = true;
            return(this._defaultProperty);
        }
Exemple #4
0
        public PropertyDescriptor GetDefaultProperty()
        {
            if (_gotDefaultProperty)
            {
                return(_defaultProperty);
            }

            DefaultPropertyAttribute attr = (DefaultPropertyAttribute)GetAttributes()[typeof(DefaultPropertyAttribute)];

            if (attr == null || attr.Name == null)
            {
                _defaultProperty = null;
            }
            else
            {
                PropertyDescriptorCollection properties = GetProperties();
                _defaultProperty = properties[attr.Name];
            }
            _gotDefaultProperty = true;
            return(_defaultProperty);
        }
Exemple #5
0
        /// <include file='doc\DefaultPropertyAttribute.uex' path='docs/doc[@for="DefaultPropertyAttribute.Equals"]/*' />
        public override bool Equals(object obj)
        {
            DefaultPropertyAttribute other = obj as DefaultPropertyAttribute;

            return((other != null) && other.Name == name);
        }
        public override bool Equals(object obj)
        {
            DefaultPropertyAttribute attribute = obj as DefaultPropertyAttribute;

            return((attribute != null) && (attribute.Name == this.name));
        }