public PlaylistCollectionViewModel(IViewModelFactory viewModelFactory, IEventAggregator eventAggregator, IContentManagerService contentManagerService, IDataService dataService, ILayoutService layoutService) { _eventAggregator = eventAggregator; _dataService = dataService; AppLayout = layoutService.AppLayout; eventAggregator.Subscribe(this); Items.AddRange(contentManagerService.RetrieveManagedPlaylists() .Values .Select(managedPlaylist => viewModelFactory.MakeViewModel <IManagedPlaylistViewModel>(managedPlaylist))); Items.AddRange(contentManagerService.RetrievePlaylists() .Select(playlist => viewModelFactory.MakeViewModel <ICustomPlaylistViewModel>(playlist))); int activePlaylist = dataService.Load <int>(Constants.DataStoreNames.ActivePlaylist); ActivateItem(Items[activePlaylist]); CollectionViewSource.GetDefaultView(Items) .SortDescriptions .Add ( new SortDescription ( string.Join(".", nameof(IPlaylistViewModel.Playlist), nameof(IPlaylistViewModel.Playlist.Name)), ListSortDirection.Ascending ) ); }