How can I select a view for my viewmodel without using code behind? I want to load a ListBox with a lot of data coming from a WCF call. Using Josh Smith's app, the view loads before the data arrives, empty. I want to receive all the data and then select the view with spinner showing progress.
// Completed Method
void _backgroundWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
DataTemplate dataTemplate = new DataTemplate();
//Leaderboards_All_View lb_all_view = new Leaderboards_All_View();
CollectionViewSource collViewSrc = new CollectionViewSource();
dataTemplate.DataType = "Leaderboards_All_View";
List<Leaderboards_All> leaderboardList = e.Result as List<Leaderboards_All>;
allViewModel =
(from lbData in leaderboardList
select new LB_Data_All_ViewModel(lbData, lb_All_ViewModel)).ToList();
foreach (LB_Data_All_ViewModel avm in allViewModel)
avm.PropertyChanged += this.OnLB_Data_All_ViewModelPropertyChanged;
this.AllViewModel = new ObservableCollection<LB_Data_All_ViewModel>(allViewModel);
this.AllViewModel.CollectionChanged += this.OnCollectionChanged;
collViewSrc.Source = AllViewModel;
lb_all_view.DataContext = collViewSrc;
}