Example #1
0
        PropertyDescriptor ICustomTypeDescriptor.GetDefaultProperty()
        {
            // This function searches the property list for the property
            // with the same name as the DefaultProperty specified, and
            // returns a property descriptor for it.  If no property is
            // found that matches DefaultProperty, a null reference is
            // returned instead.

            if (defaultProperty == null && properties.Count != 0)
            {
                defaultProperty = properties[0].Name;
            }

            PropertySpec propertySpec = null;

            if (defaultProperty != null)
            {
                int index = properties.IndexOf(defaultProperty);
                propertySpec = properties[index];
            }

            if (propertySpec != null)
            {
                return(new PropertySpecDescriptor(propertySpec, this, propertySpec.Name, null));
            }
            else
            {
                return(null);
            }
        }
Example #2
0
        PropertyDescriptor ICustomTypeDescriptor.GetDefaultProperty()
        {
            PropertySpec propertySpec = null;

            if (defaultProperty != null)
            {
                int index = properties.IndexOf(defaultProperty);
                propertySpec = properties[index];
            }
            if (propertySpec != null)
            {
                return(new PropertySpecDescriptor(propertySpec, this, propertySpec.Name, null));
            }
            return(null);
        }
Example #3
0
        PropertyDescriptor ICustomTypeDescriptor.GetDefaultProperty()
        {
            // This function searches the property list for the property
            // with the same name as the DefaultProperty specified, and
            // returns a property descriptor for it.  If no property is
            // found that matches DefaultProperty, a null reference is
            // returned instead.

            PropertySpec propertySpec = null;
            if (_defaultProperty != null)
            {
                int index = _properties.IndexOf(_defaultProperty);
                propertySpec = _properties[index];
            }

            if (propertySpec != null)
                return new PropertySpecDescriptor(propertySpec, this, propertySpec.Name, null);

            return null;
        }