private void buttonRemoveAttRule_Click(object sender, EventArgs e) { var selRows = dataGridViewAttributionRules.SelectedRows; if (selRows.Count == 0) { return; } foreach (var r in selRows.Cast <DataGridViewRow>()) { var dto = ((ObjectView <AttributionRuleDTO>)r.DataBoundItem).Object; LoadedAsset.RemoveAttributionRuleById(dto.Id); } attributionRules.DataSource = LoadedAsset.GetAttributionRules().ToList(); EditorTools.HighlightItemInGrid <AttributionRuleDTO>(dataGridViewAttributionRules, Guid.Empty); SetModified(); }