Example #1
0
        public override System.ComponentModel.PropertyDescriptorCollection GetProperties(System.ComponentModel.ITypeDescriptorContext Context, object Value, System.Attribute[] Attributes)
        {
            List <PropertyDescriptor> Properties = new List <PropertyDescriptor>();
            Type ValueType = Value.GetType();

            FieldInfo[] ValueFields = ValueType.GetFields();

            foreach (FieldInfo Field in ValueFields)
            {
                if (Field.Name == "X" | Field.Name == "Y")
                {
                    FieldPropertyDescriptor Descriptor = new FieldPropertyDescriptor(typeof(Vector2), Field, 0f);
                    Properties.Add(Descriptor);
                }
            }

            return(new PropertyDescriptorCollection(Properties.ToArray()));
        }
Example #2
0
        public override System.ComponentModel.PropertyDescriptorCollection GetProperties(System.ComponentModel.ITypeDescriptorContext Context, object Value, System.Attribute[] Attributes)
        {
            List <PropertyDescriptor> Properties = new List <PropertyDescriptor>();
            Type ValueType = Value.GetType();

            FieldInfo[] ValueFields = ValueType.GetFields();

            foreach (FieldInfo Field in ValueFields)
            {
                if (Field.Name == "R" | Field.Name == "G" | Field.Name == "B" | Field.Name == "A")
                {
                    FieldPropertyDescriptor Descriptor = new FieldPropertyDescriptor(typeof(Color4), Field, 0f);
                    Properties.Add(Descriptor);
                }
            }
            PropertyDescriptorCollection Collection = new PropertyDescriptorCollection(Properties.ToArray());

            return(Collection.Sort(new string[] {
                "R",
                "G",
                "B",
                "A"
            }));
        }