Example #1
0
        public ClienteNewControl()
        {
            InitializeComponent();
            ClienteNewViewModel = new ClienteNewControlViewModel(DependencyResolver.Instance.FacadeProvider);
            ClienteNewViewModel.InitializeViewContent();

            //Bind the DataGrid to the customer data
            this.DataContext = ClienteNewViewModel;

            CommandModel addPedidoComand = ClienteNewViewModel.SaveClienteComand;

            ButtonSaveCliente.Command          = addPedidoComand.Command;
            ButtonSaveCliente.CommandParameter = this.DataContext;
            ButtonSaveCliente.CommandBindings.Add(new CommandBinding(addPedidoComand.Command, addPedidoComand.OnExecute, addPedidoComand.OnCanExecute));
        }
        public ClienteEditDialogPage(ClienteModel clienteModel)
        {
            InitializeComponent();

            _clienteNewControlViewModel = new ClienteNewControlViewModel(DependencyResolver.Instance.FacadeProvider, clienteModel, () => Close());

            UCClienteNew.Title.Text = "EDITAR CLIENTE";
            UCClienteNew.ButtonSaveCliente.Visibility = Visibility.Collapsed;
            UCClienteNew.DataContext = _clienteNewControlViewModel;

            OkButton.Content = "Aceptar";
            var updateCommand = _clienteNewControlViewModel.UpdateClienteComand;

            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 };
        }