public static UserControl GetCtrlAddOrder() { var ctrlOrder = new CtrlAddOrder(); var addOrderModel = new Models.AddOrderModel(); var addOrderVM = new Models.AddOrderViewModel(addOrderModel) { Header = "Добавление заказа ToFly" }; //addOrderVM.CloseAction = new Action(() => { MainClass.HideUC(ctrlOrder); }); ctrlOrder.DataContext = addOrderVM; //ctrlOrder.Tag = "Добавление заказа ToFly"; return(ctrlOrder); }
public static UserControl GetCtrlAddOrder(OrderFlight curentOrder) { var ctrlOrder = new CtrlAddOrder(); //var flightOrder = new Order var addOrderModel = new Models.AddOrderModel(curentOrder); var addOrderVM = new Models.AddOrderViewModel(addOrderModel) { Header = $"Изменение заказа {curentOrder.Id}" }; ctrlOrder.DataContext = addOrderVM; // addOrderVM.CloseAction = new Action(() => { MainClass.HideUC(ctrlOrder); }); ctrlOrder.Tag = $"Изменение заказа {curentOrder.Id}"; return(ctrlOrder); }
private void UserControl_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e) { model = e.NewValue as Models.AddOrderViewModel; model.SetFocus = new Action <string>((_) => { SetFocus(_); }); }