void MenuItem_OnDeleteClicked(object sender, EventArgs e) { if (sender is MenuItem item) { if (item.CommandParameter is ChartRow chartRow) { viewModel.DeleteChartRow(chartRow); } } }