/// <summary> /// Returns a collection of properties for the type of array specified by the value parameter, /// using the specified context and properties. /// </summary> /// <param name="context">An ITypeDescriptorContext that provides a format context.</param> /// <param name="obj">An Object that specifies the type of array for which to get properties.</param> /// <param name="attributes">An array of type Attribute that is used as a filter.</param> /// <returns>A PropertyDescriptorCollection with the properties that are exposed for this data type, or a null reference (Nothing in Visual Basic) if there are no properties.</returns> public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object obj, Attribute[] attributes) { PropertyDescriptorCollection propCollection = new PropertyDescriptorCollection(null); CustomProperties attr = obj as CustomProperties; if (attr != null && context != null) { // Get series associated with custom attribute Series series = (attr.DataPointCustomProperties is Series) ? ((Series)attr.DataPointCustomProperties) : attr.DataPointCustomProperties.series; if (series != null && series.Common != null) { // Loop through all registered custom properties CustomPropertyRegistry registry = (CustomPropertyRegistry)series.Common.container.GetService(typeof(CustomPropertyRegistry)); foreach (CustomPropertyInfo attrInfo in registry.registeredCustomProperties) { // Check if attribute description matches curent selection in property browser if (IsApplicableCustomProperty(attrInfo, context.Instance)) { // Get array of property properties Attribute[] propAttributes = GetPropertyAttributes(attrInfo); // Create property descriptor CustomAttributesPropertyDescriptor propertyDescriptor = new CustomAttributesPropertyDescriptor( typeof(CustomProperties), attrInfo.Name, attrInfo.ValueType, propAttributes, attrInfo); // Add descriptor into the collection propCollection.Add(propertyDescriptor); } } // Always add "UserDefined" property for all user defined custom properties Attribute[] propUserDefinedAttributes = new Attribute[] { new NotifyParentPropertyAttribute(true), new RefreshPropertiesAttribute(RefreshProperties.All), new DescriptionAttribute(SR.DescriptionAttributeUserDefined) }; // Create property descriptor CustomAttributesPropertyDescriptor propertyUserDefinedDescriptor = new CustomAttributesPropertyDescriptor( typeof(CustomProperties), "UserDefined", typeof(string), propUserDefinedAttributes, null); // Add descriptor into the collection propCollection.Add(propertyUserDefinedDescriptor); } } return(propCollection); }
public CommonElements(ChartService chart) { _chart = chart; DataManager = new DataManager(this); CustomPropertyRegistry = new CustomPropertyRegistry(); ImageLoader = new ImageLoader(this); ChartTypeRegistry = new ChartTypeRegistry(); BorderTypeRegistry = new BorderTypeRegistry(); FormulaRegistry = new FormulaRegistry(); HotRegionsList = new(this); }