Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/HeuristicLab.ExtLibs/HeuristicLab.Netron/3.0.2672.12446/Netron.Diagramming.Core-3.0.2672.12446/PropertySystem/Providers/ControlProvider.cs

Last change on this file was 4068, checked in by swagner, 14 years ago

Sorted usings and removed unused usings in entire solution (#1094)

File size: 1.5 KB
Line 
1using System;
2using System.ComponentModel;
3namespace Netron.Diagramming.Core {
4  /// <summary>
5  /// Type descriptor provider for  the <see cref="DiagramControlBase"/> class.
6  /// </summary>
7  class ControlProvider : TypeDescriptionProvider {
8    #region Fields
9
10    /// <summary>
11    /// control descriptor
12    /// </summary>
13    private static ControlDescriptor controlDescriptor;
14
15
16    #endregion
17
18    #region Properties
19
20
21    #endregion
22
23    #region Constructor
24    public ControlProvider() {
25      controlDescriptor = new ControlDescriptor(this, typeof(DiagramControlBase));
26    }
27    #endregion
28
29    #region Methods
30    /// <summary>
31    /// Gets a custom type descriptor for the given type and object.
32    /// </summary>
33    /// <param name="objectType">The type of object for which to retrieve the type descriptor.</param>
34    /// <param name="instance">An instance of the type. Can be null if no instance was passed to the <see cref="T:System.ComponentModel.TypeDescriptor"></see>.</param>
35    /// <returns>
36    /// An <see cref="T:System.ComponentModel.ICustomTypeDescriptor"></see> that can provide metadata for the type.
37    /// </returns>
38    public override ICustomTypeDescriptor GetTypeDescriptor(Type objectType, object instance) {
39      if (typeof(DiagramControlBase).IsInstanceOfType(instance)) {
40        return controlDescriptor;
41      } else //if nothing found use the base descriptor
42        return base.GetTypeDescriptor(objectType, instance);
43
44    }
45    #endregion
46
47  }
48
49}
Note: See TracBrowser for help on using the repository browser.