How to cast a System.Windows.Controls.SelectedItemCollection?

Right, got it sorted. I kept trying to cast it like

IList<PuzzleViewModel> collection = (IList<PuzzleViewModel>)param;

Which told me it couldn’t convert from SelectedItemCollection to IList…

This is in fact what you need to do.

System.Collections.IList items = (System.Collections.IList)param;
var collection = items.Cast<PuzzleViewModel>();

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)