/// <summary> /// Edits the specified object value using the editor style provided by GetEditorStyle. /// A service provider is provided so that any required editing services can be obtained.</summary> /// <param name="context">A type descriptor context that can be used to provide additional context information</param> /// <param name="provider">A service provider object through which editing services may be obtained</param> /// <param name="value">An instance of the value being edited</param> /// <returns>The new value of the object. If the value of the object hasn't changed, /// this should return the same object it was passed.</returns> public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { if (context != null && context.Instance != null && provider != null) { IWindowsFormsEditorService editorService = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); if (editorService != null) { EditingEventArgs e = new EditingEventArgs(value); OnEditorOpening(e); NestedCollectionEditorForm collEditorFrm = CreateForm(context, m_selectionContext, value, e.GetCollectionItemCreators, e.GetItemInfo); context.OnComponentChanging(); if (editorService.ShowDialog(collEditorFrm) == DialogResult.OK) { OnCollectionChanged(context.Instance, value); context.OnComponentChanged(); } } } return(value); }
private void ThumbListViewItem_FileNameEditing(object sender, EditingEventArgs e) { // Make sure the keyboard handling doesn't interfere // if one thumbnail is in edit mode. // There should only be one thumbnail in edit mode at a time. editMode = e.Editing; }
/// <summary> /// Edits the specified object value using the editor style provided by GetEditorStyle. /// A service provider is provided so that any required editing services can be obtained.</summary> /// <param name="context">A type descriptor context that can be used to provide additional context information</param> /// <param name="provider">A service provider object through which editing services may be obtained</param> /// <param name="value">An instance of the value being edited</param> /// <returns>The new value of the object. If the value of the object hasn't changed, /// this should return the same object it was passed.</returns> public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { if (context != null && context.Instance != null && provider != null) { IWindowsFormsEditorService editorService = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); if (editorService != null) { EditingEventArgs e = new EditingEventArgs(value); OnEditorOpening(e); NestedCollectionEditorForm collEditorFrm = CreateForm(context, m_selectionContext, value, e.GetCollectionItemCreators, e.GetItemInfo); context.OnComponentChanging(); if (editorService.ShowDialog(collEditorFrm) == DialogResult.OK) { OnCollectionChanged(context.Instance, value); context.OnComponentChanged(); } } } return value; }
/// <summary> /// Raises the EditorOpening event</summary> /// <param name="e">Event args</param> protected virtual void OnEditorOpening(EditingEventArgs e) { EditorOpening.Raise(this, e); }