ImageGear .NET v25.1 - Updated
Loading Thumbnails in Code-Behind
User Guide > How to Work with... > Common Operations > Viewing > Viewing with WPF > Controls for XAML Application Development > Thumbnail Control > Loading Thumbnails > Loading Thumbnails in Code-Behind

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;