Example #1
0
            public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object value, Attribute[] attributes)
            {
                DesignLineStyle lineStyle = (DesignLineStyle)value;
                const int       N         = 3;

                PropertyDescriptor[] properties = new PropertyDescriptor[N];
                properties[0] = new ShadowProperty(LineColorDisplayName,
                                                   TypeDescriptor.CreateProperty(
                                                       typeof(DesignLineStyle),
                                                       LineColorPropertyName,
                                                       typeof(ExpressionInfo),
                                                       new TypeConverterAttribute(lineStyle.IsNullable
                                                ? typeof(NullableColorExpressionInfoConverter)
                                                : typeof(ColorExpressionInfoConverter))
                                                       ));
                properties[1] = new ShadowProperty(LineWidthDisplayName,
                                                   TypeDescriptor.CreateProperty(
                                                       typeof(DesignLineStyle),
                                                       LineWidthPropertyName,
                                                       typeof(ExpressionInfo),
                                                       new TypeConverterAttribute(lineStyle.IsNullable
                                                ? typeof(NullableLengthExpressionInfoConverter)
                                                : typeof(LengthExpressionInfoConverter))
                                                       ));
                properties[2] = new ShadowProperty(LineStyleDisplayName,
                                                   TypeDescriptor.CreateProperty(
                                                       typeof(DesignLineStyle),
                                                       LineStylePropertyName,
                                                       typeof(ExpressionInfo),
                                                       new TypeConverterAttribute(lineStyle.IsNullable
                                                ? typeof(NullableEnumExpressionInfoConverter)
                                                : typeof(EnumExpressionInfoConverter))
                                                       ));

                PropertyDescriptorCollection pdc = new PropertyDescriptorCollection(properties);

                return(pdc.Sort(PropertySortOrder));
            }
Example #2
0
            public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object value, Attribute[] attributes)
            {
                DesignTextStyle lineStyle = (DesignTextStyle)value;
                const int       N         = 6;

                PropertyDescriptor[] properties = new PropertyDescriptor[N];
                properties[0] = new ShadowProperty(FontFamilyDisplayName,
                                                   TypeDescriptor.CreateProperty(
                                                       typeof(DesignTextStyle),
                                                       FontFamilyPropertyName,
                                                       typeof(ExpressionInfo),
                                                       new TypeConverterAttribute(lineStyle.IsNullable
                                                ? typeof(NullableFontFamilyExpressionInfoConverter)
                                                : typeof(FontFamilyExpressionInfoConverter))
                                                       ));
                properties[1] = new ShadowProperty(FontSizeDisplayName,
                                                   TypeDescriptor.CreateProperty(
                                                       typeof(DesignTextStyle),
                                                       FontSizePropertyName,
                                                       typeof(ExpressionInfo),
                                                       new TypeConverterAttribute(lineStyle.IsNullable
                                                ? typeof(NullableLengthExpressionInfoConverter)
                                                : typeof(LengthExpressionInfoConverter))
                                                       ));
                properties[2] = new ShadowProperty(FontStyleDisplayName,
                                                   TypeDescriptor.CreateProperty(
                                                       typeof(DesignTextStyle),
                                                       FontStylePropertyName,
                                                       typeof(ExpressionInfo),
                                                       new TypeConverterAttribute(lineStyle.IsNullable
                                                ? typeof(NullableEnumExpressionInfoConverter)
                                                : typeof(EnumExpressionInfoConverter))
                                                       ));
                properties[3] = new ShadowProperty(FontWeightDisplayName,
                                                   TypeDescriptor.CreateProperty(
                                                       typeof(DesignTextStyle),
                                                       FontWeightPropertyName,
                                                       typeof(ExpressionInfo),
                                                       new TypeConverterAttribute(lineStyle.IsNullable
                                                ? typeof(NullableEnumExpressionInfoConverter)
                                                : typeof(EnumExpressionInfoConverter))
                                                       ));
                properties[4] = new ShadowProperty(FontDecorationDisplayName,
                                                   TypeDescriptor.CreateProperty(
                                                       typeof(DesignTextStyle),
                                                       FontDecorationPropertyName,
                                                       typeof(ExpressionInfo),
                                                       new TypeConverterAttribute(lineStyle.IsNullable
                                                ? typeof(NullableEnumExpressionInfoConverter)
                                                : typeof(EnumExpressionInfoConverter))
                                                       ));
                properties[5] = new ShadowProperty(FontColorDisplayName,
                                                   TypeDescriptor.CreateProperty(
                                                       typeof(DesignTextStyle),
                                                       FontColorPropertyName,
                                                       typeof(ExpressionInfo),
                                                       new TypeConverterAttribute(lineStyle.IsNullable
                                                ? typeof(NullableColorExpressionInfoConverter)
                                                : typeof(ColorExpressionInfoConverter))
                                                       ));

                PropertyDescriptorCollection pdc = new PropertyDescriptorCollection(properties);

                return(pdc.Sort(PropertySortOrder));
            }