private void EditButtonClicked() { Debug.Assert(m_currentValue != null, "m_currentValue != null"); Type editorType = ((CellEditorData)m_currentValue.Tag).GetEditorType(EditorManager); Debug.Assert(editorType != null, "Edit button clicked, but there is no editor for value type '" + m_currentValue.ValueTypeName + "'."); if (m_editorDialog == null) { m_editorDialog = new EditorDialog(MessageBoxButtons.OKCancel); } if (m_editorDialogSettings != null) { m_editorDialogSettings.ApplyToWindow(m_editorDialog); } m_editorDialog.ReadOnly = IsReallyReadOnly(m_currentValue); m_editorDialog.CurrentEditorType = editorType; // Keep the value in the remote AppDomain, if the editor supports this. if (m_editorDialog.IsRemoteEditor) { m_editorDialog.DisplayRemoteValue(m_currentValue.CreateWrapper()); } else { m_editorDialog.DisplayValue(m_currentValue.GetValue()); } m_editorDialog.FocusOnEditor(); // Set focus to the editor every time the dialog is shown. if (m_editorDialog.ShowDialog(DataGridTableStyle.DataGrid) == DialogResult.OK) { m_currentValue.SetValue(m_editorDialog.GetValue()); OnEditorCommitted(new MemberWrapperEventArgs(m_currentValue)); } if (m_editorDialogSettings == null) { m_editorDialogSettings = new WindowSettings(); } m_editorDialogSettings.ReadFromWindow(m_editorDialog); }