The code below demonstrates how to show an open file dialog and set the ItemsSource to a collection containing a filename string for each selected file:
C# Example |
Copy Code |
---|---|
OpenFileDialog ofd = new OpenFileDialog(); ofd.Multiselect = true; ofd.ShowDialog(); ObservableCollection<string> thumbnailFiles = new ObservableCollection<string>(); foreach (string fileInfo in ofd.FileNames) { thumbnailFiles.Add(fileInfo); } thumbnailList.ItemsSource = thumbnailFiles; |