/// <summary> /// Removes the given images from the gallery. /// </summary> /// <param name="parameter">The list of images to remove, of type System.Windows.Controls.SelectedItemCollection (from ListBox SelectedItems).</param> public void RemoveImages(object parameter) { System.Collections.IList list = parameter as System.Collections.IList; List <Photo> photos = list.Cast <Photo>().ToList(); foreach (Photo p in photos) { _gallery.Remove(p); } }