WPF – Display Image in Wrappannel along with textbox

  c++, listview, windows, winforms, wpf

Hi stackoverflow experts,
Recently only I have started coding in WPF and stuck somewhere.
I have to display the list of the image along with the text, I tried to find on google but as usual all are using hard coded values.

Step 1: In XAML file I have used the along with the wrap panel and code is below :

 <ListView Width="auto" Name="listviewSource" BorderBrush="{x:Null}">
    <ListView.ItemsPanel>
          <ItemsPanelTemplate>
              <WrapPanel Width="auto" Height="150" Orientation="Vertical" UseLayoutRounding="True" / >
           </ItemsPanelTemplate>
        </ListView.ItemsPanel>
       </ListView>

Step 2: Currently I am able to bind all image successfully, and code :

Image imageData = new Image();
List<Image> ImageList = new List<Image>();  // List of Image
List<string> imageName = new List<string>();  // list of name 

imageData = bitmapData // here bitmapData is having data which is already computed
imageName.Add(name); // This is the issue, how to display name below image 
ImageList.Add(imageData );
listviewSource.ItemSource = ImageList;

Source: Windows Questions

LEAVE A COMMENT