private void EditColumn() { DataGridColumnModel columnModel = datagridColumnsListBox.SelectedItem as DataGridColumnModel; if (columnModel == null) { return; } using (ModelEditingScope scope = columnModel.Column.BeginEdit(columnModel.Column.Name + " Changed")) { EditDataGridColumnsUserInterface ui = new EditDataGridColumnsUserInterface(_context, columnModel, _dataSourceProperties); // Use Windows Forms to show the design time because Windows Forms knows about the VS message pump System.Windows.Forms.DialogResult result = DesignerDialog.ShowDesignerDialog("Edit Column", ui, 360, 470); if (result == System.Windows.Forms.DialogResult.OK) { scope.Complete(); _dataSourcePropertiesCVS.View.Refresh(); } else { scope.Revert(); } } }
/// <summary> /// Add and configure Columns /// </summary> private void AddColumnsMenuAction_Execute(object sender, MenuActionEventArgs e) { using (ModelEditingScope scope = e.Selection.PrimarySelection.BeginEdit("Columns Changed")) { AddDataGridColumnsUserInterface ui = new AddDataGridColumnsUserInterface(e.Context, e.Selection.PrimarySelection); // Use Windows Forms to show the design time because Windows Forms knows about the VS message pump System.Windows.Forms.DialogResult result = DesignerDialog.ShowDesignerDialog("Add/Edit Columns", ui); if (result == System.Windows.Forms.DialogResult.OK) { scope.Complete(); } else { scope.Revert(); } } }