JobTitle grade
/// <summary> /// /// </summary> [DisplayName( "" ), Description( " " ), Category( "" )] public class Employee { private JobTitle jt = new JobTitle (); /// <summary> /// , /// ( JobTitle) /// </summary> [DisplayName( "" ), Description( " " ), Category( " " )] [TypeConverter( typeof ( JobTitleTypeConverter ))] public JobTitle jobtitle { get { return jt; } set { jt = value ; } } private JobTitleCollection jobTitles = new JobTitleCollection (); /// <summary> /// , /// PropertyGrid /// </summary> [Description( " " ), Category( "" ), DisplayName( "" )] [TypeConverter( typeof ( JobTitleCollectionConverter ))] public JobTitleCollection JobTitles { get { return jobTitles; } set { jobTitles = value ; } } }
/// <summary> /// /// </summary> [DisplayName( "" ), Description( " " ), Category( "" )] public class Employee { private JobTitle jt = new JobTitle (); /// <summary> /// , /// ( JobTitle) /// </summary> [DisplayName( "" ), Description( " " ), Category( " " )] [TypeConverter( typeof ( JobTitleTypeConverter ))] public JobTitle jobtitle { get { return jt; } set { jt = value ; } } private JobTitleCollection jobTitles = new JobTitleCollection (); /// <summary> /// , /// PropertyGrid /// </summary> [Description( " " ), Category( "" ), DisplayName( "" )] [TypeConverter( typeof ( JobTitleCollectionConverter ))] public JobTitleCollection JobTitles { get { return jobTitles; } set { jobTitles = value ; } } }
/// <summary> /// /// </summary> [DisplayName( "" ), Description( " " ), Category( "" )] public class Employee { private JobTitle jt = new JobTitle (); /// <summary> /// , /// ( JobTitle) /// </summary> [DisplayName( "" ), Description( " " ), Category( " " )] [TypeConverter( typeof ( JobTitleTypeConverter ))] public JobTitle jobtitle { get { return jt; } set { jt = value ; } } private JobTitleCollection jobTitles = new JobTitleCollection (); /// <summary> /// , /// PropertyGrid /// </summary> [Description( " " ), Category( "" ), DisplayName( "" )] [TypeConverter( typeof ( JobTitleCollectionConverter ))] public JobTitleCollection JobTitles { get { return jobTitles; } set { jobTitles = value ; } } }
/// <summary> /// /// </summary> [DisplayName( "" ), Description( " " ), Category( "" )] public class Employee { private JobTitle jt = new JobTitle (); /// <summary> /// , /// ( JobTitle) /// </summary> [DisplayName( "" ), Description( " " ), Category( " " )] [TypeConverter( typeof ( JobTitleTypeConverter ))] public JobTitle jobtitle { get { return jt; } set { jt = value ; } } private JobTitleCollection jobTitles = new JobTitleCollection (); /// <summary> /// , /// PropertyGrid /// </summary> [Description( " " ), Category( "" ), DisplayName( "" )] [TypeConverter( typeof ( JobTitleCollectionConverter ))] public JobTitleCollection JobTitles { get { return jobTitles; } set { jobTitles = value ; } } }
/// <summary> /// /// </summary> [DisplayName( "" ), Description( " " ), Category( "" )] public class Employee { private JobTitle jt = new JobTitle (); /// <summary> /// , /// ( JobTitle) /// </summary> [DisplayName( "" ), Description( " " ), Category( " " )] [TypeConverter( typeof ( JobTitleTypeConverter ))] public JobTitle jobtitle { get { return jt; } set { jt = value ; } } private JobTitleCollection jobTitles = new JobTitleCollection (); /// <summary> /// , /// PropertyGrid /// </summary> [Description( " " ), Category( "" ), DisplayName( "" )] [TypeConverter( typeof ( JobTitleCollectionConverter ))] public JobTitleCollection JobTitles { get { return jobTitles; } set { jobTitles = value ; } } }
/// <summary> /// /// </summary> [DisplayName( "" ), Description( " " ), Category( "" )] public class Employee { private JobTitle jt = new JobTitle (); /// <summary> /// , /// ( JobTitle) /// </summary> [DisplayName( "" ), Description( " " ), Category( " " )] [TypeConverter( typeof ( JobTitleTypeConverter ))] public JobTitle jobtitle { get { return jt; } set { jt = value ; } } private JobTitleCollection jobTitles = new JobTitleCollection (); /// <summary> /// , /// PropertyGrid /// </summary> [Description( " " ), Category( "" ), DisplayName( "" )] [TypeConverter( typeof ( JobTitleCollectionConverter ))] public JobTitleCollection JobTitles { get { return jobTitles; } set { jobTitles = value ; } } }
/// <summary> /// /// </summary> [DisplayName( "" ), Description( " " ), Category( "" )] public class Employee { private JobTitle jt = new JobTitle (); /// <summary> /// , /// ( JobTitle) /// </summary> [DisplayName( "" ), Description( " " ), Category( " " )] [TypeConverter( typeof ( JobTitleTypeConverter ))] public JobTitle jobtitle { get { return jt; } set { jt = value ; } } private JobTitleCollection jobTitles = new JobTitleCollection (); /// <summary> /// , /// PropertyGrid /// </summary> [Description( " " ), Category( "" ), DisplayName( "" )] [TypeConverter( typeof ( JobTitleCollectionConverter ))] public JobTitleCollection JobTitles { get { return jobTitles; } set { jobTitles = value ; } } }
/// <summary> /// /// </summary> [DisplayName( "" ), Description( " " ), Category( "" )] public class Employee { private JobTitle jt = new JobTitle (); /// <summary> /// , /// ( JobTitle) /// </summary> [DisplayName( "" ), Description( " " ), Category( " " )] [TypeConverter( typeof ( JobTitleTypeConverter ))] public JobTitle jobtitle { get { return jt; } set { jt = value ; } } private JobTitleCollection jobTitles = new JobTitleCollection (); /// <summary> /// , /// PropertyGrid /// </summary> [Description( " " ), Category( "" ), DisplayName( "" )] [TypeConverter( typeof ( JobTitleCollectionConverter ))] public JobTitleCollection JobTitles { get { return jobTitles; } set { jobTitles = value ; } } }
/// <summary> /// /// </summary> [DisplayName( "" ), Description( " " ), Category( "" )] public class Employee { private JobTitle jt = new JobTitle (); /// <summary> /// , /// ( JobTitle) /// </summary> [DisplayName( "" ), Description( " " ), Category( " " )] [TypeConverter( typeof ( JobTitleTypeConverter ))] public JobTitle jobtitle { get { return jt; } set { jt = value ; } } private JobTitleCollection jobTitles = new JobTitleCollection (); /// <summary> /// , /// PropertyGrid /// </summary> [Description( " " ), Category( "" ), DisplayName( "" )] [TypeConverter( typeof ( JobTitleCollectionConverter ))] public JobTitleCollection JobTitles { get { return jobTitles; } set { jobTitles = value ; } } }
/// <summary> /// /// </summary> [DisplayName( "" ), Description( " " ), Category( "" )] public class Employee { private JobTitle jt = new JobTitle (); /// <summary> /// , /// ( JobTitle) /// </summary> [DisplayName( "" ), Description( " " ), Category( " " )] [TypeConverter( typeof ( JobTitleTypeConverter ))] public JobTitle jobtitle { get { return jt; } set { jt = value ; } } private JobTitleCollection jobTitles = new JobTitleCollection (); /// <summary> /// , /// PropertyGrid /// </summary> [Description( " " ), Category( "" ), DisplayName( "" )] [TypeConverter( typeof ( JobTitleCollectionConverter ))] public JobTitleCollection JobTitles { get { return jobTitles; } set { jobTitles = value ; } } }
/// <summary> /// /// </summary> [DisplayName( "" ), Description( " " ), Category( "" )] public class Employee { private JobTitle jt = new JobTitle (); /// <summary> /// , /// ( JobTitle) /// </summary> [DisplayName( "" ), Description( " " ), Category( " " )] [TypeConverter( typeof ( JobTitleTypeConverter ))] public JobTitle jobtitle { get { return jt; } set { jt = value ; } } private JobTitleCollection jobTitles = new JobTitleCollection (); /// <summary> /// , /// PropertyGrid /// </summary> [Description( " " ), Category( "" ), DisplayName( "" )] [TypeConverter( typeof ( JobTitleCollectionConverter ))] public JobTitleCollection JobTitles { get { return jobTitles; } set { jobTitles = value ; } } }
/// <summary> /// /// </summary> [DisplayName( "" ), Description( " " ), Category( "" )] public class Employee { private JobTitle jt = new JobTitle (); /// <summary> /// , /// ( JobTitle) /// </summary> [DisplayName( "" ), Description( " " ), Category( " " )] [TypeConverter( typeof ( JobTitleTypeConverter ))] public JobTitle jobtitle { get { return jt; } set { jt = value ; } } private JobTitleCollection jobTitles = new JobTitleCollection (); /// <summary> /// , /// PropertyGrid /// </summary> [Description( " " ), Category( "" ), DisplayName( "" )] [TypeConverter( typeof ( JobTitleCollectionConverter ))] public JobTitleCollection JobTitles { get { return jobTitles; } set { jobTitles = value ; } } }
/// <summary> /// /// </summary> [DisplayName( "" ), Description( " " ), Category( "" )] public class Employee { private JobTitle jt = new JobTitle (); /// <summary> /// , /// ( JobTitle) /// </summary> [DisplayName( "" ), Description( " " ), Category( " " )] [TypeConverter( typeof ( JobTitleTypeConverter ))] public JobTitle jobtitle { get { return jt; } set { jt = value ; } } private JobTitleCollection jobTitles = new JobTitleCollection (); /// <summary> /// , /// PropertyGrid /// </summary> [Description( " " ), Category( "" ), DisplayName( "" )] [TypeConverter( typeof ( JobTitleCollectionConverter ))] public JobTitleCollection JobTitles { get { return jobTitles; } set { jobTitles = value ; } } }
/// <summary> /// /// </summary> [DisplayName( "" ), Description( " " ), Category( "" )] public class Employee { private JobTitle jt = new JobTitle (); /// <summary> /// , /// ( JobTitle) /// </summary> [DisplayName( "" ), Description( " " ), Category( " " )] [TypeConverter( typeof ( JobTitleTypeConverter ))] public JobTitle jobtitle { get { return jt; } set { jt = value ; } } private JobTitleCollection jobTitles = new JobTitleCollection (); /// <summary> /// , /// PropertyGrid /// </summary> [Description( " " ), Category( "" ), DisplayName( "" )] [TypeConverter( typeof ( JobTitleCollectionConverter ))] public JobTitleCollection JobTitles { get { return jobTitles; } set { jobTitles = value ; } } }
/// <summary> /// /// </summary> [DisplayName( "" ), Description( " " ), Category( "" )] public class Employee { private JobTitle jt = new JobTitle (); /// <summary> /// , /// ( JobTitle) /// </summary> [DisplayName( "" ), Description( " " ), Category( " " )] [TypeConverter( typeof ( JobTitleTypeConverter ))] public JobTitle jobtitle { get { return jt; } set { jt = value ; } } private JobTitleCollection jobTitles = new JobTitleCollection (); /// <summary> /// , /// PropertyGrid /// </summary> [Description( " " ), Category( "" ), DisplayName( "" )] [TypeConverter( typeof ( JobTitleCollectionConverter ))] public JobTitleCollection JobTitles { get { return jobTitles; } set { jobTitles = value ; } } }
/// <summary> /// /// </summary> [DisplayName( "" ), Description( " " ), Category( "" )] public class Employee { private JobTitle jt = new JobTitle (); /// <summary> /// , /// ( JobTitle) /// </summary> [DisplayName( "" ), Description( " " ), Category( " " )] [TypeConverter( typeof ( JobTitleTypeConverter ))] public JobTitle jobtitle { get { return jt; } set { jt = value ; } } private JobTitleCollection jobTitles = new JobTitleCollection (); /// <summary> /// , /// PropertyGrid /// </summary> [Description( " " ), Category( "" ), DisplayName( "" )] [TypeConverter( typeof ( JobTitleCollectionConverter ))] public JobTitleCollection JobTitles { get { return jobTitles; } set { jobTitles = value ; } } }
/// <summary> /// /// </summary> [DisplayName( "" ), Description( " " ), Category( "" )] public class Employee { private JobTitle jt = new JobTitle (); /// <summary> /// , /// ( JobTitle) /// </summary> [DisplayName( "" ), Description( " " ), Category( " " )] [TypeConverter( typeof ( JobTitleTypeConverter ))] public JobTitle jobtitle { get { return jt; } set { jt = value ; } } private JobTitleCollection jobTitles = new JobTitleCollection (); /// <summary> /// , /// PropertyGrid /// </summary> [Description( " " ), Category( "" ), DisplayName( "" )] [TypeConverter( typeof ( JobTitleCollectionConverter ))] public JobTitleCollection JobTitles { get { return jobTitles; } set { jobTitles = value ; } } }
/// <summary> /// /// </summary> [DisplayName( "" ), Description( " " ), Category( "" )] public class Employee { private JobTitle jt = new JobTitle (); /// <summary> /// , /// ( JobTitle) /// </summary> [DisplayName( "" ), Description( " " ), Category( " " )] [TypeConverter( typeof ( JobTitleTypeConverter ))] public JobTitle jobtitle { get { return jt; } set { jt = value ; } } private JobTitleCollection jobTitles = new JobTitleCollection (); /// <summary> /// , /// PropertyGrid /// </summary> [Description( " " ), Category( "" ), DisplayName( "" )] [TypeConverter( typeof ( JobTitleCollectionConverter ))] public JobTitleCollection JobTitles { get { return jobTitles; } set { jobTitles = value ; } } }
/// <summary> /// /// </summary> [DisplayName( "" ), Description( " " ), Category( "" )] public class Employee { private JobTitle jt = new JobTitle (); /// <summary> /// , /// ( JobTitle) /// </summary> [DisplayName( "" ), Description( " " ), Category( " " )] [TypeConverter( typeof ( JobTitleTypeConverter ))] public JobTitle jobtitle { get { return jt; } set { jt = value ; } } private JobTitleCollection jobTitles = new JobTitleCollection (); /// <summary> /// , /// PropertyGrid /// </summary> [Description( " " ), Category( "" ), DisplayName( "" )] [TypeConverter( typeof ( JobTitleCollectionConverter ))] public JobTitleCollection JobTitles { get { return jobTitles; } set { jobTitles = value ; } } }
/// <summary> /// /// </summary> [DisplayName( "" ), Description( " " ), Category( "" )] public class Employee { private JobTitle jt = new JobTitle (); /// <summary> /// , /// ( JobTitle) /// </summary> [DisplayName( "" ), Description( " " ), Category( " " )] [TypeConverter( typeof ( JobTitleTypeConverter ))] public JobTitle jobtitle { get { return jt; } set { jt = value ; } } private JobTitleCollection jobTitles = new JobTitleCollection (); /// <summary> /// , /// PropertyGrid /// </summary> [Description( " " ), Category( "" ), DisplayName( "" )] [TypeConverter( typeof ( JobTitleCollectionConverter ))] public JobTitleCollection JobTitles { get { return jobTitles; } set { jobTitles = value ; } } }
/// <summary> /// /// </summary> [DisplayName( "" ), Description( " " ), Category( "" )] public class Employee { private JobTitle jt = new JobTitle (); /// <summary> /// , /// ( JobTitle) /// </summary> [DisplayName( "" ), Description( " " ), Category( " " )] [TypeConverter( typeof ( JobTitleTypeConverter ))] public JobTitle jobtitle { get { return jt; } set { jt = value ; } } private JobTitleCollection jobTitles = new JobTitleCollection (); /// <summary> /// , /// PropertyGrid /// </summary> [Description( " " ), Category( "" ), DisplayName( "" )] [TypeConverter( typeof ( JobTitleCollectionConverter ))] public JobTitleCollection JobTitles { get { return jobTitles; } set { jobTitles = value ; } } }
/// <summary> /// /// </summary> [DisplayName( "" ), Description( " " ), Category( "" )] public class Employee { private JobTitle jt = new JobTitle (); /// <summary> /// , /// ( JobTitle) /// </summary> [DisplayName( "" ), Description( " " ), Category( " " )] [TypeConverter( typeof ( JobTitleTypeConverter ))] public JobTitle jobtitle { get { return jt; } set { jt = value ; } } private JobTitleCollection jobTitles = new JobTitleCollection (); /// <summary> /// , /// PropertyGrid /// </summary> [Description( " " ), Category( "" ), DisplayName( "" )] [TypeConverter( typeof ( JobTitleCollectionConverter ))] public JobTitleCollection JobTitles { get { return jobTitles; } set { jobTitles = value ; } } }
/// <summary> /// /// </summary> [DisplayName( "" ), Description( " " ), Category( "" )] public class Employee { private JobTitle jt = new JobTitle (); /// <summary> /// , /// ( JobTitle) /// </summary> [DisplayName( "" ), Description( " " ), Category( " " )] [TypeConverter( typeof ( JobTitleTypeConverter ))] public JobTitle jobtitle { get { return jt; } set { jt = value ; } } private JobTitleCollection jobTitles = new JobTitleCollection (); /// <summary> /// , /// PropertyGrid /// </summary> [Description( " " ), Category( "" ), DisplayName( "" )] [TypeConverter( typeof ( JobTitleCollectionConverter ))] public JobTitleCollection JobTitles { get { return jobTitles; } set { jobTitles = value ; } } }
/// <summary> /// /// </summary> [DisplayName( "" ), Description( " " ), Category( "" )] public class Employee { private JobTitle jt = new JobTitle (); /// <summary> /// , /// ( JobTitle) /// </summary> [DisplayName( "" ), Description( " " ), Category( " " )] [TypeConverter( typeof ( JobTitleTypeConverter ))] public JobTitle jobtitle { get { return jt; } set { jt = value ; } } private JobTitleCollection jobTitles = new JobTitleCollection (); /// <summary> /// , /// PropertyGrid /// </summary> [Description( " " ), Category( "" ), DisplayName( "" )] [TypeConverter( typeof ( JobTitleCollectionConverter ))] public JobTitleCollection JobTitles { get { return jobTitles; } set { jobTitles = value ; } } }
/// <summary> /// /// </summary> [DisplayName( "" ), Description( " " ), Category( "" )] public class Employee { private JobTitle jt = new JobTitle (); /// <summary> /// , /// ( JobTitle) /// </summary> [DisplayName( "" ), Description( " " ), Category( " " )] [TypeConverter( typeof ( JobTitleTypeConverter ))] public JobTitle jobtitle { get { return jt; } set { jt = value ; } } private JobTitleCollection jobTitles = new JobTitleCollection (); /// <summary> /// , /// PropertyGrid /// </summary> [Description( " " ), Category( "" ), DisplayName( "" )] [TypeConverter( typeof ( JobTitleCollectionConverter ))] public JobTitleCollection JobTitles { get { return jobTitles; } set { jobTitles = value ; } } }
/// <summary> /// /// </summary> [DisplayName( "" ), Description( " " ), Category( "" )] public class Employee { private JobTitle jt = new JobTitle (); /// <summary> /// , /// ( JobTitle) /// </summary> [DisplayName( "" ), Description( " " ), Category( " " )] [TypeConverter( typeof ( JobTitleTypeConverter ))] public JobTitle jobtitle { get { return jt; } set { jt = value ; } } private JobTitleCollection jobTitles = new JobTitleCollection (); /// <summary> /// , /// PropertyGrid /// </summary> [Description( " " ), Category( "" ), DisplayName( "" )] [TypeConverter( typeof ( JobTitleCollectionConverter ))] public JobTitleCollection JobTitles { get { return jobTitles; } set { jobTitles = value ; } } }
/// <summary> /// /// </summary> [DisplayName( "" ), Description( " " ), Category( "" )] public class Employee { private JobTitle jt = new JobTitle (); /// <summary> /// , /// ( JobTitle) /// </summary> [DisplayName( "" ), Description( " " ), Category( " " )] [TypeConverter( typeof ( JobTitleTypeConverter ))] public JobTitle jobtitle { get { return jt; } set { jt = value ; } } private JobTitleCollection jobTitles = new JobTitleCollection (); /// <summary> /// , /// PropertyGrid /// </summary> [Description( " " ), Category( "" ), DisplayName( "" )] [TypeConverter( typeof ( JobTitleCollectionConverter ))] public JobTitleCollection JobTitles { get { return jobTitles; } set { jobTitles = value ; } } }
/// <summary> /// /// </summary> [DisplayName( "" ), Description( " " ), Category( "" )] public class Employee { private JobTitle jt = new JobTitle (); /// <summary> /// , /// ( JobTitle) /// </summary> [DisplayName( "" ), Description( " " ), Category( " " )] [TypeConverter( typeof ( JobTitleTypeConverter ))] public JobTitle jobtitle { get { return jt; } set { jt = value ; } } private JobTitleCollection jobTitles = new JobTitleCollection (); /// <summary> /// , /// PropertyGrid /// </summary> [Description( " " ), Category( "" ), DisplayName( "" )] [TypeConverter( typeof ( JobTitleCollectionConverter ))] public JobTitleCollection JobTitles { get { return jobTitles; } set { jobTitles = value ; } } }
/// <summary> /// /// </summary> [DisplayName( "" ), Description( " " ), Category( "" )] public class Employee { private JobTitle jt = new JobTitle (); /// <summary> /// , /// ( JobTitle) /// </summary> [DisplayName( "" ), Description( " " ), Category( " " )] [TypeConverter( typeof ( JobTitleTypeConverter ))] public JobTitle jobtitle { get { return jt; } set { jt = value ; } } private JobTitleCollection jobTitles = new JobTitleCollection (); /// <summary> /// , /// PropertyGrid /// </summary> [Description( " " ), Category( "" ), DisplayName( "" )] [TypeConverter( typeof ( JobTitleCollectionConverter ))] public JobTitleCollection JobTitles { get { return jobTitles; } set { jobTitles = value ; } } }
/// <summary> /// /// </summary> [DisplayName( "" ), Description( " " ), Category( "" )] public class Employee { private JobTitle jt = new JobTitle (); /// <summary> /// , /// ( JobTitle) /// </summary> [DisplayName( "" ), Description( " " ), Category( " " )] [TypeConverter( typeof ( JobTitleTypeConverter ))] public JobTitle jobtitle { get { return jt; } set { jt = value ; } } private JobTitleCollection jobTitles = new JobTitleCollection (); /// <summary> /// , /// PropertyGrid /// </summary> [Description( " " ), Category( "" ), DisplayName( "" )] [TypeConverter( typeof ( JobTitleCollectionConverter ))] public JobTitleCollection JobTitles { get { return jobTitles; } set { jobTitles = value ; } } }
/// <summary> /// /// </summary> [DisplayName( "" ), Description( " " ), Category( "" )] public class Employee { private JobTitle jt = new JobTitle (); /// <summary> /// , /// ( JobTitle) /// </summary> [DisplayName( "" ), Description( " " ), Category( " " )] [TypeConverter( typeof ( JobTitleTypeConverter ))] public JobTitle jobtitle { get { return jt; } set { jt = value ; } } private JobTitleCollection jobTitles = new JobTitleCollection (); /// <summary> /// , /// PropertyGrid /// </summary> [Description( " " ), Category( "" ), DisplayName( "" )] [TypeConverter( typeof ( JobTitleCollectionConverter ))] public JobTitleCollection JobTitles { get { return jobTitles; } set { jobTitles = value ; } } }
The solution of the problem
- /// <summary>
- /// Employee's position
- /// </ summary>
- [DisplayName ( "Position" ), Description ( "Position of Employee" ), Category ( "Information about Employee" )]
- [TypeConverter ( typeof ( JobTitleConverter ))]
- public class JobTitle : MyItem
- {
- /// <summary>
- /// Constructor
- /// </ summary>
- public JobTitle () {}
- /// <summary>
- /// Constructor
- /// </ summary>
- /// <param name = "ID"> Record ID </ param>
- /// <param name = "ItemName"> Name </ param>
- public JobTitle ( int ID, string ItemName)
- {
- this .ID = ID;
- this .ItemName = ItemName;
- }
- }
Post collection class
- /// <summary>
- /// JobTitle type conversion class
- /// Converts to the String type and back to JobTitle
- /// Also, allows you to display a collection of posts in the form of a drop-down list.
- /// </ summary>
- public class JobTitleTypeConverter : ExpandableObjectConverter
- {
- /// <summary>
- /// Returns a value indicating whether the object supports a standard set of values.
- /// which can be selected from the list.
- /// If you do not force the value to true, then
- /// that the handler will not accept your method GetStandardValues and you will not see
- /// your list of values to select
- /// </ summary>
- /// <param name = "context"> </ param>
- /// <returns> </ returns>
- public override bool GetStandardValuesSupported ( ITypeDescriptorContext context)
- {
- return true ;
- }
- /// <summary>
- /// This method can be excluded, but in the future it will allow using this class of converter.
- /// to call from different classes.
- /// To do this, it is enough to add to the case section the name of another class that should contain a property
- /// JobTitle with the link function with a drop-down list
- /// </ summary>
- /// <param name = "context"> </ param>
- /// <returns> </ returns>
- private JobTitleCollection GetCollection (System.ComponentModel. ITypeDescriptorContext context)
- {
- JobTitleCollection collection = new JobTitleCollection ();
- switch (context.Instance.GetType (). Name)
- {
- case "Employee" :
- collection = ((Employee) context.Instance) .JobTitles;
- break ;
- default :
- collection = ((Employee) context.Instance) .JobTitles;
- break ;
- }
- return collection;
- }
- /// <summary>
- /// The method returns a list of values from the collection of posts for display in the drop-down
- /// list of values PropertyGrid for employee position
- /// </ summary>
- /// <param name = "context"> </ param>
- /// <returns> </ returns>
- public override TypeConverter. StandardValuesCollection GetStandardValues ( ITypeDescriptorContext context)
- {
- return new StandardValuesCollection (GetCollection (context));
- }
- /// <summary>
- /// The method checks if the received property value can be converted from the user.
- /// in the type we need
- /// </ summary>
- /// <param name = "context"> </ param>
- /// <param name = "destinationType"> </ param>
- /// <returns> </ returns>
- public override bool CanConvertTo ( ITypeDescriptorContext context, Type destinationType)
- {
- if (destinationType.Equals ( typeof ( string )))
- {
- return true ;
- }
- else
- {
- return false ;
- }
- }
- /// <summary>
- /// Conversion of JobTitle type to a string to display the value in the PropertyGrid field
- /// </ summary>
- /// <param name = "context"> </ param>
- /// <param name = "culture"> </ param>
- /// <param name = "value"> </ param>
- /// <param name = "destinationType"> </ param>
- /// <returns> </ returns>
- public override object ConvertTo ( ITypeDescriptorContext context,
- System.Globalization. CultureInfo culture, object value , Type destinationType)
- {
- if (destinationType == typeof ( string ) && value is JobTitle )
- {
- JobTitle item = ( JobTitle ) value ;
- Return item.FullName;
- }
- return base .ConvertTo (context, culture, value , destinationType);
- }
- /// <summary>
- /// Check for the possibility of reverse conversion of the string representation to the type JobTitle
- /// </ summary>
- /// <param name = "context"> </ param>
- /// <param name = "sourceType"> </ param>
- /// <returns> </ returns>
- public override bool CanConvertFrom ( ITypeDescriptorContext context, Type sourceType)
- {
- if (sourceType.Equals ( typeof ( string )))
- {
- return true ;
- }
- else
- {
- return false ;
- }
- }
- /// <summary>
- /// Convert a string representation of a post to a JobTitle type.
- /// The disadvantage of this conversion is that the correctness of the cast operation depends on the format.
- /// string representation of the JobTitle type, namely, from duplicate values.
- /// </ summary>
- /// <param name = "context"> </ param>
- /// <param name = "culture"> </ param>
- /// <param name = "value"> </ param>
- /// <returns> </ returns>
- public override object ConvertFrom ( ITypeDescriptorContext context,
- System.Globalization. CultureInfo culture, object value )
- {
- if ( value .GetType () == typeof ( string ))
- {
- JobTitle itemSelected = GetCollection (context) .Count.Equals ( 0 )?
- new JobTitle (): GetCollection (context) [ 0 ];
- foreach ( JobTitle Item in GetCollection (context))
- {
- string sCraftName = Item.FullName;
- if (sCraftName.Equals (( string ) value ))
- {
- itemSelected = Item;
- }
- }
- return itemSelected;
- }
- else
- return base .ConvertFrom (context, culture, value );
- }
- /// <summary>
- /// Returns a value indicating whether the collection of standard values is an exhaustive list.
- /// returned by the method.
- ///
- /// false - data can be entered manually
- /// true - just select from the list
- /// </ summary>
- /// <param name = "context"> </ param>
- /// <returns> </ returns>
- public override bool GetStandardValuesExclusive ( ITypeDescriptorContext context)
- {
- return true ;
- }
- /// <summary>
- /// Method Constructor
- /// </ summary>
- public JobTitleTypeConverter () {}
- }
Additional class for describing properties of a collection of JobTitle objects
- /// <summary>
- /// Class collection of posts
- /// Contains methods that provide information for describing the contents of collection properties
- /// and display in the PropertyGrid
- /// </ summary>
- [DisplayName ( "List of Positions" ), Description ( "List of Employee Positions" ), Category ( "Employee Information" )]
- public class JobTitleCollection : CollectionBase , ICustomTypeDescriptor
- {
- #region Collection Methods
- public void Add ( JobTitle Item)
- {
- this .List.Add (Item);
- }
- public void Remove ( JobTitle Item)
- {
- this .List.Remove (Item);
- }
- public JobTitle this [ int Index]
- {
- get { return ( JobTitle ) this .List [Index]; }
- }
- #endregion
- #region Implementing the ICustomTypeDescriptor Interface
- public String GetClassName ()
- {
- return TypeDescriptor.GetClassName ( this , true );
- }
- public AttributeCollection GetAttributes ()
- {
- return TypeDescriptor.GetAttributes ( this , true );
- }
- public String GetComponentName ()
- {
- return TypeDescriptor.GetComponentName ( this , true );
- }
- public TypeConverter GetConverter ()
- {
- Return TypeDescriptor.GetConverter ( this , true );
- }
- public EventDescriptor GetDefaultEvent ()
- {
- return TypeDescriptor.GetDefaultEvent ( this , true );
- }
- public PropertyDescriptor GetDefaultProperty ()
- {
- return TypeDescriptor.GetDefaultProperty ( this , true );
- }
- public object GetEditor ( Type editorBaseType)
- {
- return TypeDescriptor.GetEditor ( this , editorBaseType, true );
- }
- public EventDescriptorCollection GetEvents ( Attribute [] attributes)
- {
- return TypeDescriptor.GetEvents ( this , attributes, true );
- }
- public EventDescriptorCollection GetEvents ()
- {
- return TypeDescriptor.GetEvents ( this , true );
- }
- public object GetPropertyOwner ( PropertyDescriptor pd)
- {
- return this ;
- }
- public PropertyDescriptorCollection GetProperties ( Attribute [] attributes)
- {
- return GetProperties ();
- }
- public PropertyDescriptorCollection GetProperties ()
- {
- PropertyDescriptorCollection pds = new PropertyDescriptorCollection ( null );
- for ( int i = 0 ; i < this .List.Count; i ++)
- {
- JobTitleCollectionPropertyDescriptor pd = new JobTitleCollectionPropertyDescriptor ( this , i);
- pds.Add (pd);
- }
- return pds;
- }
- #endregion
- }
Additional class of posts collection converter
- /// <summary>
- /// Property description class for a collection of JobTitle objects
- /// </ summary>
- public class JobTitleCollectionPropertyDescriptor : PropertyDescriptor
- {
- private JobTitleCollection collection = null ;
- private int index = - 1 ;
- public JobTitleCollectionPropertyDescriptor (JobTitleCollection coll, int idx):
- base ( "#" + idx.ToString (), null )
- {
- this .collection = coll;
- this .index = idx;
- }
- public override AttributeCollection Attributes
- {
- get
- {
- return new AttributeCollection ( null );
- }
- }
- public override bool CanResetValue ( object component)
- {
- return true ;
- }
- public override Type ComponentType
- {
- get
- {
- return this .collection.GetType ();
- }
- }
- public override string DisplayName
- {
- get
- {
- JobTitle Item = this .collection [index];
- Return Item.FullName;
- }
- }
- public override string Description
- {
- get
- {
- JobTitle Item = this .collection [index];
- StringBuilder sb = new StringBuilder ();
- sb.Append (Item.ItemName);
- sb.Append ( "," );
- sb.Append (index + 1 );
- return sb.ToString ();
- }
- }
- public override object GetValue ( object component)
- {
- return this .collection [index];
- }
- public override bool IsReadOnly
- {
- get { return false ; }
- }
- public override string Name
- {
- get { return "#" + index.ToString (); }
- }
- public override Type PropertyType
- {
- get { return this .collection [index] .GetType (); }
- }
- public override void ResetValue ( object component)
- {
- }
- public override bool ShouldSerializeValue ( object component)
- {
- return true ;
- }
- public override void SetValue ( object component, object value )
- {
- }
- }
Additional class of post type converter
- /// <summary>
- /// Converter class for the standard collection display in a PropertyGrid
- /// Replaces the designation "(Collection)" with "(Posts ...)"
- /// </ summary>
- public class JobTitleCollectionConverter : ExpandableObjectConverter
- {
- public override object ConvertTo ( ITypeDescriptorContext context, System.Globalization. CultureInfo culture,
- object value , Type destType)
- {
- if (destType == typeof ( string ) && value is JobTitleCollection)
- {
- return "(Posts ...)" ;
- }
- return base .ConvertTo (context, culture, value , destType);
- }
- }
Class ancestor employee classes and positions
- /// <summary>
- /// Class performing the JobTitle type conversion for correct display in the collection editor
- /// If you do not implement it, the internal name will be displayed in the JobTitle collection editor window
- /// JobTitle class
- /// </ summary>
- public class JobTitleConverter : ExpandableObjectConverter
- {
- public override object ConvertTo ( ITypeDescriptorContext context, System.Globalization. CultureInfo culture,
- object value , Type destType)
- {
- if (destType == typeof ( string ) && value is JobTitle)
- {
- JobTitle jobtitle = (JobTitle) value ;
- return jobtitle.FullName;
- }
- return base .ConvertTo (context, culture, value , destType);
- }
- }
You can download the source code of the example .
- /// <summary>
- /// Ancestor class of entities
- /// </ summary>
- public class MyItem
- {
- private int iID = - 1 ;
- /// <summary>
- /// record ID
- /// </ summary>
- [Description ( "Item Number" ), Category ( "Collections" ), DisplayName ( "Number" )]
- public int ID
- {
- get { return iID; }
- set {iID = value ; }
- }
- private string sItemName = "" ;
- /// <summary>
- /// Name
- /// </ summary>
- [Description ( "Item Name" ), Category ( "Collections" ), DisplayName ( "Title" )]
- public string ItemName
- {
- get { return sItemName; }
- set {sItemName = value ; }
- }
- /// <summary>
- /// Full name of the object
- /// </ summary>
- [Browsable ( false )]
- public string FullName
- {
- get
- {
- return String .Format ( "{0} No. {1}" , ItemName, ID.ToString ());
- }
- }
- }
Source: https://habr.com/ru/post/78024/
All Articles