public static Collection MakeCollection() { string folder = @"C:\Users\Public\Pictures\Sample Pictures"; string[] files = Directory.GetFiles(folder); Collection coll = new Collection(); coll.Name = "Sample Pictures"; bool anyItems = false; foreach (string path in files) { string extension = Path.GetExtension(path); bool isJpeg = (0 == string.Compare(".jpg", extension, true)); bool isPng = (0 == string.Compare(".png", extension, true)); if (isJpeg || isPng) { anyItems = true; FileInfo info = new FileInfo(path); coll.AddItem(Path.GetFileNameWithoutExtension(path), path, null, new ItemImage(path) , new Facet("File name", Path.GetFileName(path) , isJpeg ? "*.jpg" : null , isPng ? "*.png" : null ) , new Facet("File size", info.Length / 1000) , new Facet("Creation time", info.CreationTime) , new Facet("Link:", new FacetHyperlink("click to view image", path)) ); } } if (anyItems) { coll.SetFacetDisplay("Creation time", false, true, false); coll.SetFacetFormat("File size", "#,#0 kb"); } else { coll.AddItem("No pictures", null, string.Format("The folder \"{0}\" does not contain any JPEG or PNG files.", folder), null); } return coll; }