public ProveedorNewControl() { InitializeComponent(); _proveedorNewViewModel = new ProveedorNewViewModel(DependencyResolver.Instance.FacadeProvider); _proveedorNewViewModel.InitializeViewContent(); //Bind the DataGrid to the customer data this.DataContext = _proveedorNewViewModel; CommandModel addPedidoComand = _proveedorNewViewModel.SaveProveedorComand; ButtonSaveProveedor.Command = addPedidoComand.Command; ButtonSaveProveedor.CommandParameter = this.DataContext; ButtonSaveProveedor.CommandBindings.Add(new CommandBinding(addPedidoComand.Command, addPedidoComand.OnExecute, addPedidoComand.OnCanExecute)); }
public ProveedorEditDialog(ProveedorModel proveedor) { InitializeComponent(); _proveedorNewViewModel = new ProveedorNewViewModel(DependencyResolver.Instance.FacadeProvider, proveedor, () => Close()); UCProveedor.Title.Text = "EDITAR PROVEEDOR"; UCProveedor.ButtonSaveProveedor.Visibility = Visibility.Collapsed; UCProveedor.DataContext = _proveedorNewViewModel; OkButton.Content = "Aceptar"; var updateCommand = _proveedorNewViewModel.UpdateProveedorComand; OkButton.Command = updateCommand.Command; OkButton.CommandBindings.Add(new CommandBinding(updateCommand.Command, updateCommand.OnExecute, updateCommand.OnCanExecute)); CancelButton.Content = "Cancelar"; // define the dialog buttons this.Buttons = new Button[] { this.OkButton, this.CancelButton }; }