private void SetCurrentPage(RecognizeTransition st) { this.Dispatcher.Invoke(new Action(() => { var pages = this.recognizeWizard.Items.Cast <WizardPage>(); foreach (var page in pages) { var uc = page.Content as UserControl; if (uc != null) { var vm = uc.DataContext as BaseStateControlViewModel; if (vm != null && vm.State == st) { this.recognizeWizard.CurrentPage = page; this.ViewModel.SetBusy(st.ToString()); return; } } } })); }