void mi_Click(object sender, RoutedEventArgs e) { MenuItem mi = sender as MenuItem; ContextMenu cm = mi.Parent as ContextMenu; DataGridCell curCell = (DataGridCell)cm.PlacementTarget; string colName = (string)curCell.Column.Header; MenuDays md = (MenuDays)curCell.DataContext; ChoseMealView mbv = new ChoseMealView(md, viewModelMain.Id, colName); mbv.ShowDialog(); viewModelMain = new MainViewModel(sel, selList); this.DataContext = viewModelMain; }
void do_Click(object sender, MouseButtonEventArgs e) { DataGrid mi = sender as DataGrid; DataGridCellInfo curCell=(DataGridCellInfo)mi.CurrentCell; string colName = (string)curCell.Column.Header; if (!colName.Equals("День")) { MenuDays md = (MenuDays)curCell.Item; ChoseMealView mbv = new ChoseMealView(md, viewModelMain.Id, colName); mbv.ShowDialog(); viewModelMain = new MainViewModel(sel, selList); this.DataContext = viewModelMain; } }