public SettingsDialogViewModel(ModelContainer modelConatiner) { userSettings = modelConatiner.userSettings; CloseDialog = new RelayCommand(OnCloseAction, allow); Closing = new RelayCommand(CloseAction, allow); SaveCommand = new RelayCommand(SaveAction, allow); ControlSettingsViewModel = new ControlSettingsViewModel(userSettings.ControlSettings); }
private void ControlSettingsView_KeyDown(object sender, KeyEventArgs e) { e.Handled = true; if (vm == null) { vm = (ControlSettingsViewModel)DataContext; } if (currentLabel == null) { return; } //Binding b = new Binding("Value"); //b.Source = vm.KeyboardAssignment[prevContent.ToString()]; currentLabel.Content = e.Key; vm.AssignKeyAction(prevKey, e.Key); PreviewKeyDown -= ControlSettingsView_KeyDown; lv.UnselectAll(); // BindingOperations.GetBindingExpressionBase(currentLabel, Label.ContentProperty).UpdateTarget(); }
public ControlSettingsView() { InitializeComponent(); vm = (ControlSettingsViewModel)DataContext; }