uri = new Uri(fl.FullName);
list.Add(new BitmapImage(uri));
btn[i] = new Button
{
Width = 180,
Height = 150,
BorderThickness = new Thickness(2, 2, 2, 2),
Margin = new Thickness(0, 5, 5, 0)
};
dock[i] = new StackPanel();
img[i] = new Image();
img[i].Source = list[i];
dock[i].Children.Add(img[i]);
lbl[i] = new Label();
lbl[i].Content = list[i].ToString();
dock[i].Children.Add(lbl[i]);
btn[i].Content = dock[i];
wrapContainer.Children.Add(btn[i]);