src/Misc/EFTools/DesignXmlCore/VirtualTreeGrid/DropDownControl.cs
/// <summary>
///     Factory method for creating the appropriate drop-down control based on the given property descriptor.
///     If the property descriptor supports a UITypeEditor, a TypeEditorHost will be created with that editor.
///     If not, and the TypeConverver attached to the PropertyDescriptor supports standard values, a
///     TypeEditorHostListBox will be created with this TypeConverter.
/// </summary>
/// <param name="propertyDescriptor">A property descriptor describing the property being set</param>
/// <param name="instance">The object instance being edited</param>
/// <param name="editControlStyle">The type of control to show in the edit area.</param>
/// <returns>A TypeEditorHost instance if the given property descriptor supports it, null otherwise.</returns>
Factory method for creating the appropriate drop-down control based on the given property descriptor.
If the property descriptor supports a UITypeEditor, a TypeEditorHost will be created with that editor.
If not, and the TypeConverver attached to the PropertyDescriptor supports standard values, a
TypeEditorHostListBox will be created with this TypeConverter.
Factory method for creating the appropriate drop - down control based on the given property descriptor . If the property descriptor supports a UITypeEditor a TypeEditorHost will be created with that editor . If not and the TypeConverver attached to the PropertyDescriptor supports standard values a TypeEditorHostListBox will be created with this TypeConverter .
public static TypeEditorHost Create(
            PropertyDescriptor propertyDescriptor, object instance, TypeEditorHostEditControlStyle editControlStyle)
        {
            TypeEditorHost dropDown = null;
            if (propertyDescriptor != null)
            {
                var uiTypeEditor = propertyDescriptor.GetEditor(typeof(UITypeEditor)) as UITypeEditor;
                if (uiTypeEditor != null) 
                {
                    dropDown = new TypeEditorHost(uiTypeEditor, propertyDescriptor, instance, editControlStyle);
                }
                else
                {
                    var converter = propertyDescriptor.Converter;
                    if (converter != null
                        && converter.GetStandardValuesSupported(null)) 
                    {
                        dropDown = new TypeEditorHostListBox(converter, propertyDescriptor, instance, editControlStyle);
                    }
                }
            }
            return dropDown;
        }
public static TypeEditorHost Create ( PropertyDescriptor propertyDescriptor , object instance , TypeEditorHostEditControlStyle editControlStyle ) { TypeEditorHost dropDown = null ; if ( propertyDescriptor != null ) { var uiTypeEditor = propertyDescriptor . GetEditor ( typeof ( UITypeEditor ) ) as UITypeEditor ; if ( uiTypeEditor != null ) { dropDown = new TypeEditorHost ( uiTypeEditor , propertyDescriptor , instance , editControlStyle ) ; } else { var converter = propertyDescriptor . Converter ; if ( converter != null && converter . GetStandardValuesSupported ( null ) ) { dropDown = new TypeEditorHostListBox ( converter , propertyDescriptor , instance , editControlStyle ) ; } } } return dropDown ; }
Factory method for creating the appropriate drop-down control based on the given property descriptor.
Factory method for creating the appropriate drop - down control based on the given property descriptor .
// UITypeEditor case // converter case
A TypeEditorHost instance if the given property descriptor supports it, null otherwise.
A TypeEditorHost instance if the given property descriptor supports it null otherwise .
propertyDescriptor
PropertyDescriptor
A property descriptor describing the property being set
A property descriptor describing the property being set
instance
object
The object instance being edited
The object instance being edited
editControlStyle
TypeEditorHostEditControlStyle
The type of control to show in the edit area.
The type of control to show in the edit area .