private void CtrlSearchCommandBinding_OnExecuted(object sender, ExecutedRoutedEventArgs e) { var searchParam = new CtrlSearch { DocumentSearchType = typeof(CtrlArticle), SearchWindowHeader = "Artikelsuche", ParentUserControl = this }; searchParam.OnSearchComplete += result => { ViewModel.Article = (CtrlArticle)result; ViewModel.SaveArticle(); }; CtrlSearch.DoSearch(searchParam); }
private void ArticleUserControl_OnLoaded(object sender, RoutedEventArgs e) { var searchParam = new CtrlSearch { DocumentSearchType = typeof(CtrlArticle), SearchWindowHeader = "Artikelsuche", ParentUserControl = this }; searchParam.OnSearchComplete += result => { if (result != null) { ViewModel.Article = (CtrlArticle)result; LockUserControl(); } else { ViewModel.NewArticle(); } }; CtrlSearch.DoSearch(searchParam); }