using OperationControl.ViewModels.Views.Operacao; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; namespace OperationControl.Views.Operacao { /// /// Interaction logic for OperacaoRightView.xaml /// public partial class OperacaoRightView : System.Windows.Controls.UserControl { public OperacaoRightViewModel _vm; public OperacaoRightView() { InitializeComponent(); _vm = new OperacaoRightViewModel(); DataContext = _vm; } public OperacaoRightView(OperacaoRightViewModel vm) { InitializeComponent(); _vm = vm; DataContext = _vm; } private void cmbModoOperacao_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (DataContext is OperacaoRightViewModel vm && sender is System.Windows.Controls.ComboBox combo && combo.SelectedItem is AgroBase.Models.Enums.ModoOperacao modo) { if (vm.CarregarParametrosPadraoCommand?.CanExecute(modo) == true) vm.CarregarParametrosPadraoCommand.Execute(modo); } } } }