public searchCustomer(searchCustomerTypeEnum displayType) { InitializeComponent(); dataContext = new searchCustomer_ModelView(displayType); this.DataContext = dataContext; dataContext.NewCustomerRequested += (s, a) => { newCustomerUC = new NewCustomerUC(displayType); newCustomerWindow = new Window() { Title = "Új ügyfél", Content = newCustomerUC, SizeToContent = SizeToContent.WidthAndHeight }; newCustomerVM = newCustomerUC.DataContext as NewCustomer_ViewModel; newCustomerVM.CustomerInserted += (so, ar) => { dataContext.selectedCustomer = (CustomerBaseRepresentation)so; dataContext.OnCustomerSelected(EventArgs.Empty); newCustomerWindow.Close(); }; newCustomerWindow.Show(); }; DataProxy.Instance.CustomersChanged += (s, a) => { dataContext.RefreshCustomerList(); }; }