private void SortSpeakers() { if (Speakers == null) { return; } var imageSpeakers = new List <ImageSpeaker> (); foreach (var item in Speakers) { imageSpeakers.Add(new ImageSpeaker(item)); } var sorted = from speaker in imageSpeakers orderby speaker.Name.GetLastName() group speaker by speaker.NameSort into speakerGroup select new Grouping <string, ImageSpeaker> (speakerGroup.Key, speakerGroup); InitializeSpeakers(); foreach (var item in sorted) { GroupedSpeakers.Add(item); } }
private void InitializeSpeakers() { if (Speakers == null) { GroupedSpeakers = new ObservableCollection <Grouping <string, ImageSpeaker> > (); } else { GroupedSpeakers.Clear(); } }