private void ExecuteSearchCommand(object sender, ExecutedRoutedEventArgs e) { // note: different way to refresh the binding. ModernDialog d = new ModernDialog(); d.Content = "Loading data..."; d.Closed += new EventHandler((s, ex) => { ViewData.Status = "Still loading..."; }); var ctx = SynchronizationContext.Current; System.Threading.ThreadPool.QueueUserWorkItem( (x) => { ViewData.DoSearch(ctx); this.Dispatcher.BeginInvoke( new Action <SearchPage>((y) => { //this.DataContext = null; this.DataContext = ViewData; d.Close(); if (ViewData.Images != null) { ViewData.Status = String.Format("Loaded: {0} images.", ViewData.Images.Count); } else { ViewData.Status = String.Format("No Image Found!"); } }), new object[] { this } ); }, null ); d.ShowDialog(); }