I want to give folder path and from that folder path If That folder contains 3 images I want to display those 3 images into Stac
You should use an ItemsControl like shown below. It uses a vertical StackPanel as default panel for its items.
<ItemsControl x:Name="imageItems">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Image Source="{Binding}" Margin="5"/>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
Set the ItemsSource of the ItemsControl like this:
imageItems.ItemsSource = Directory.EnumerateFiles(FOLDERPATH, "*.png");
The conversion from path string to ImageSource is performed by built-in type conversion in WPF.
You may use a different ItemsPanel like this:
<ItemsControl ...>
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
...
</ItemsControl>