/// <summary> /// Attaches the event handler from the view model to the slider and textbox which are inside a template. /// </summary> /// <param name="root">The ContentControl which has the slider and textbox in its template.</param> public static void AddEventHandlers(ActionViewModelBase viewModel, ContentControl root) { // --- ACTION SLIDER --- // Add value changed event handler to action slider root.ApplyTemplate(); Slider actionSlider = (Slider)root.Template.FindName("ActionSlider", root); actionSlider.ValueChanged += viewModel.HandleActionSliderValueChange; // --- USER ACTION INPUT --- TextBox actionInputTextbox = (TextBox)root.Template.FindName("ActionInputTextBox", root); int maxAction = viewModel.TotalActions - 1; InitUserInputField(actionInputTextbox, "CurrentUserActionIndex", 0, maxAction, viewModel.HandleUserActionInput); }
private void CallAction(ActionViewModelBase actionViewModel) { _logger.Info($"CallAction() called for {actionViewModel?.ToString()}"); actionViewModel?.DoExecute(); }