Ejemplo n.º 1
0
 /// <summary>
 /// Raises the ProvideUITypeEditor event.
 /// </summary>
 /// <param name="e">Provides event data</param>
 protected virtual void OnProvideUITypeEditor(ProvideUITypeEditorEventArgs e)
 {
     ProvideUITypeEditorEventHandler handler = ProvideUITypeEditor;
     if (handler != null)
         handler(this, e);
 }
Ejemplo n.º 2
0
 internal void InvokeProvideUITypeEditor(ProvideUITypeEditorEventArgs e)
 {
     OnProvideUITypeEditor(e);
 }
Ejemplo n.º 3
0
        private UITypeEditor GetTypeEditor()
        {
            PropertyDescriptor propertyDescriptor = GetPropertyDescriptor();

            if (_PropertySettings != null && _PropertySettings.UITypeEditor != null)
            {
                return _PropertySettings.UITypeEditor;
            }

            AdvPropertyGrid grid = AdvPropertyGrid;
            if (grid != null && grid.HasProvideUITypeEditorHandler)
            {
                ProvideUITypeEditorEventArgs args = new ProvideUITypeEditorEventArgs(GetPropertyName(), propertyDescriptor);
                grid.InvokeProvideUITypeEditor(args);
                if (args.EditorSpecified) return args.UITypeEditor;
            }

            object value = PropertyValue;
            if (value is ICustomTypeDescriptor)
            {
                ICustomTypeDescriptor descriptor = (ICustomTypeDescriptor)value;
                UITypeEditor editor=(UITypeEditor)descriptor.GetEditor(typeof(UITypeEditor));
                if (editor != null)
                    return editor;
            }
            return (UITypeEditor)propertyDescriptor.GetEditor(typeof(UITypeEditor));
        }