private void OnKeyDown(object sender, KeyEventArgs e) { Control ctrl = sender as Control; if (ctrl != null) { if (e.Key == Key.Enter) { StrategyVM strategyVM = ctrl.Tag as StrategyVM; if (strategyVM != null) { if (e.Key == Key.Enter) { strategyVM.UpdateStrategy(); } else { ctrl.DataContext = null; ctrl.DataContext = strategyVM; } } ctrl.Background = Brushes.White; } else { ctrl.Background = Brushes.MistyRose; } } }
private void OnStrategyChanged(object sender, RoutedPropertyChangedEventArgs <object> e) { FrameworkElement ctrl = sender as FrameworkElement; StrategyVM strategyVM = ctrl.DataContext as StrategyVM; if (strategyVM != null) { strategyVM.UpdateStrategy(); } }
private void ValueChanged(object sender, RoutedPropertyChangedEventArgs <object> e) { var updownctrl = sender as IntegerUpDown; if (updownctrl != null && e.OldValue != null && e.NewValue != null) { StrategyVM strategyVM = updownctrl.Tag as StrategyVM; if (strategyVM != null) { strategyVM.UpdateStrategy(); } } }