<ListBox Height="500" Name="lbThumbnails" IsEnabled="False" SelectionMode="Single" ItemsSource="{Binding Source}" > <ListBox.ItemsPanel> <ItemsPanelTemplate> <StackPanel></StackPanel> </ItemsPanelTemplate> </ListBox.ItemsPanel> <ListBox.ItemTemplate> <DataTemplate> <Border BorderBrush="#FFB4B4B4" Opacity="0.7" BorderThickness="2" CornerRadius="5" > <Image Source="{Binding UriSource}" Stretch="Fill" Width="100" Height="100" Margin="20" /> </Border> </DataTemplate> </ListBox.ItemTemplate> </ListBox>
pictures = new List<BitmapImage>(); try { DirectoryInfo pictureImageDir = new DirectoryInfo("Thumbnails"); foreach (FileInfo koiImageFile in pictureImageDir.GetFiles("*.jpg")) { Uri uri = new Uri(koiImageFile.FullName); pictures.Add(new BitmapImage(uri)); } lbThumbnails.ItemsSource = pictures; } catch (Exception ex) { System.Windows.MessageBox.Show("Errore non previsto"); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)