public void InitPreview() { PreviewItems = new ObservableCollection <MediaItemVM>(); int i = 0; foreach (MediaItem item in mediaManager.GetMediaItems(folder, Constants.MediaExt)) { if (++i > Constants.MaxPreviewItems) { break; } PreviewItems.Add(new MediaItemVM(item, this.mediaManager)); } }