The Labs \ Source Viewer \ SSCLI \ System.ComponentModel \ InstanceCreationEditor

  1. //------------------------------------------------------------------------------
  2. // <copyright file="TypeConverter.cs" company="Microsoft">
  3. //
  4. // Copyright (c) 2006 Microsoft Corporation. All rights reserved.
  5. //
  6. // The use and distribution terms for this software are contained in the file
  7. // named license.txt, which can be found in the root of this distribution.
  8. // By using this software in any fashion, you are agreeing to be bound by the
  9. // terms of this license.
  10. //
  11. // You must not remove this notice, or any other, from this software.
  12. //
  13. // </copyright>
  14. //------------------------------------------------------------------------------
  15. /*
  16. */
  17. namespace System.ComponentModel
  18. {
  19.     using Microsoft.Win32;
  20.     using System.Collections;
  21.     using System.ComponentModel.Design.Serialization;
  22.     using System.Diagnostics;
  23.     using System.Globalization;
  24.     using System.Runtime.Serialization.Formatters;
  25.     using System.Runtime.Remoting;
  26.     using System.Runtime.InteropServices;
  27.     using System.Security.Permissions;
  28.    
  29.     /// <devdoc>
  30.     /// An InstanceCreationEditor allows the user to create an instance of a particular type of property from a dropdown
  31.     /// Within the PropertyGrid. Usually, the text specified by InstanceCreationEditor.Text will be displayed on the
  32.     /// dropdown from the PropertyGrid as a link or button. When clicked, the InstanceCreationEditor.CreateInstance
  33.     /// method will be called with the Type of the object to create.
  34.     /// </devdoc>
  35.     [HostProtection(SharedState = true)]
  36.     public abstract class InstanceCreationEditor
  37.     {
  38.        
  39.         /// <devdoc>
  40.         /// </devdoc>
  41.         public virtual string Text {
  42.             get { return SR.GetString(SR.InstanceCreationEditorDefaultText); }
  43.         }
  44.        
  45.         /// <devdoc>
  46.         /// This method is invoked when you user chooses the link displayed by the PropertyGrid for the InstanceCreationEditor.
  47.         /// The object returned from this method must be an instance of the specified type, or null in which case the editor will do nothing.
  48.         ///
  49.         /// </devdoc>
  50.         public abstract object CreateInstance(ITypeDescriptorContext context, Type instanceType);
  51.     }
  52. }

Developer Fusion