Hi, I am unable to populate the chapters using code-behind. What am I doing wrong? Playlist gets created but without chapters.
var items = e.Result;
ObservableCollection<RadMediaItem> itemsSource = new ObservableCollection<RadMediaItem>();
foreach (OnlineTraining item in items)
{
RadMediaItem media = new RadMediaItem();
media.Source = new Uri(item.FileName, UriKind.RelativeOrAbsolute);
media.Title = item.Title;
media.Description = item.Description;
media.ImageSource = new System.Windows.Media.Imaging.BitmapImage(new Uri(item.ImageSource, UriKind.RelativeOrAbsolute));
ObservableCollection<RadMediaChapter> mediachapter = new ObservableCollection<RadMediaChapter>();
RadMediaChapter chapter = new RadMediaChapter();
chapter.Position = "00:00:05";
chapter.Title = "test";
mediachapter.Add(chapter);
chapter = new RadMediaChapter();
chapter.Position = "00:10:00";
chapter.Title = "test2";
mediachapter.Add(chapter);
chapter = new RadMediaChapter();
chapter.Position = "00:20:00";
chapter.Title = "test2";
mediachapter.Add(chapter);
chapter = new RadMediaChapter();
chapter.Position = "00:30:00";
chapter.Title = "test2";
mediachapter.Add(chapter);
chapter = new RadMediaChapter();
chapter.Position = "00:40:00";
chapter.Title = "test2";
mediachapter.Add(chapter);
chapter = new RadMediaChapter();
chapter.Position = "00:50:00";
chapter.Title = "test2";
mediachapter.Add(chapter);
media.Items.Add(mediachapter);
itemsSource.Add(media);
}
RadMediaPlayer1.ItemsSource = itemsSource;
var items = e.Result;
ObservableCollection<RadMediaItem> itemsSource = new ObservableCollection<RadMediaItem>();
foreach (OnlineTraining item in items)
{
RadMediaItem media = new RadMediaItem();
media.Source = new Uri(item.FileName, UriKind.RelativeOrAbsolute);
media.Title = item.Title;
media.Description = item.Description;
media.ImageSource = new System.Windows.Media.Imaging.BitmapImage(new Uri(item.ImageSource, UriKind.RelativeOrAbsolute));
ObservableCollection<RadMediaChapter> mediachapter = new ObservableCollection<RadMediaChapter>();
RadMediaChapter chapter = new RadMediaChapter();
chapter.Position = "00:00:05";
chapter.Title = "test";
mediachapter.Add(chapter);
chapter = new RadMediaChapter();
chapter.Position = "00:10:00";
chapter.Title = "test2";
mediachapter.Add(chapter);
chapter = new RadMediaChapter();
chapter.Position = "00:20:00";
chapter.Title = "test2";
mediachapter.Add(chapter);
chapter = new RadMediaChapter();
chapter.Position = "00:30:00";
chapter.Title = "test2";
mediachapter.Add(chapter);
chapter = new RadMediaChapter();
chapter.Position = "00:40:00";
chapter.Title = "test2";
mediachapter.Add(chapter);
chapter = new RadMediaChapter();
chapter.Position = "00:50:00";
chapter.Title = "test2";
mediachapter.Add(chapter);
media.Items.Add(mediachapter);
itemsSource.Add(media);
}
RadMediaPlayer1.ItemsSource = itemsSource;