public void OnDeletePropertyGridItem(object sender, EventArgs e) { PropertyAdapterBase adapter = CurrentGrid.SelectedObject as PropertyAdapterBase; XmlNode element = GetSelectedGridObject(); if (element != null) { WixFiles.UndoManager.BeginNewCommandRange(); adapter.RemoveProperty(element); RefreshGrid(string.Empty); } }
protected void OnDeletePropertyGridItem(object sender, EventArgs e) { XmlNode element = GetSelectedProperty(); if (element == null) { throw new WixEditException("No element found to delete!"); } // Temporarily store the XmlAttributeAdapter, while resetting the elementPropertyGrid. PropertyAdapterBase attAdapter = (PropertyAdapterBase)elementPropertyGrid.SelectedObject; elementPropertyGrid.SelectedObject = null; wixFiles.UndoManager.BeginNewCommandRange(); attAdapter.RemoveProperty(element); // Update the elementPropertyGrid. elementPropertyGrid.SelectedObject = attAdapter; elementPropertyGrid.Update(); }