using System; using System.ComponentModel; namespace Netron.Diagramming.Core { /// /// Type descriptor provider for the class. /// class ControlProvider : TypeDescriptionProvider { #region Fields /// /// control descriptor /// private static ControlDescriptor controlDescriptor; #endregion #region Properties #endregion #region Constructor public ControlProvider() { controlDescriptor = new ControlDescriptor(this, typeof(DiagramControlBase)); } #endregion #region Methods /// /// Gets a custom type descriptor for the given type and object. /// /// The type of object for which to retrieve the type descriptor. /// An instance of the type. Can be null if no instance was passed to the . /// /// An that can provide metadata for the type. /// public override ICustomTypeDescriptor GetTypeDescriptor(Type objectType, object instance) { if (typeof(DiagramControlBase).IsInstanceOfType(instance)) { return controlDescriptor; } else //if nothing found use the base descriptor return base.GetTypeDescriptor(objectType, instance); } #endregion } }