Click here to Skip to main content
16,020,840 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
The canvas always have the last image of a folder. Where is the others images??

What I have tried:

if (imageFiles.Count() > 0)
            {
                foreach (string str in imageFiles)
                {
                    CreateATyhumbnail(str);

                }
            }


private void CreateATyhumbnail(string imagePath)
        {
            // Create an Image control  
            Image thumbnailImage = new Image();
           
            thumbnailImage.Width = 130;
            // Create a BitmapImage and sets its DecodePixelWidth and DecodePixelHeight  
            BitmapImage bmpImage = new BitmapImage();
            bmpImage.BeginInit();
            bmpImage.UriSource = new Uri(imagePath);
            
            bmpImage.DecodePixelWidth = 120;
            bmpImage.DecodePixelHeight = 120;
            bmpImage.EndInit();
            // Set Source property of Image  
            thumbnailImage.Source = bmpImage;
            
            imageGrid.Children.Add(thumbnailImage);
            thumbnailImage.Margin = new Thickness(15);
            //Canvas.SetLeft(thumbnailImage,130);
Posted
Updated 15-Dec-20 16:55pm

1 solution

Because they're all in one place ... stacked one upon the other ...

You need to vary the "position" of each image if you want to see more than one at a time.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900