WPF Image Gallery

I am going to manage a touch application (not a web application) that should present groups of images to users. The desire to present a grid of 3x3 images with the ability to fast forward / rewind. They can select several, and I will show only these images.

I don't see the ListView doing what I want (although WPF is big enough so that I can skip something obvious!). I could create a Grid and create images in grid positions. But I was hoping for something more pleasant, more automated, less rude. Any thoughts or pointers?

+6
c # image wpf xaml gallery
source share
3 answers

You might want to use an ItemsControl / ListBox , and then set the UniformGrid panel to display 3x3 as the ItemsPanel to create a suitable WPF-compatible solution.

  <ListBox ScrollViewer.HorizontalScrollBarVisibility="Disabled"> <ListBox.ItemsPanel> <ItemsPanelTemplate> <UniformGrid Rows="3" Columns="3"/> </ItemsPanelTemplate> </ListBox.ItemsPanel> <Image Source="Images\img1.jpg" Width="100"/> <Image Source="Images\img2.jpg" Width="50"/> <Image Source="Images\img3.jpg" Width="200"/> <Image Source="Images\img4.jpg" Width="75"/> <Image Source="Images\img5.jpg" Width="125"/> <Image Source="Images\img6.jpg" Width="100"/> <Image Source="Images\img7.jpg" Width="50"/> <Image Source="Images\img8.jpg" Width="50"/> <Image Source="Images\img9.jpg" Width="50"/> </ListBox> 

You need to set your image collection as an ItemsSource binding if you are looking for a dynamic solution here. But the question is too broad to give an exact answer.

+7
source share

I know this is a pretty old question, but I answer because this page is on the first page on Google, and this link may be useful to someone.

WPF Photo Viewer Demo

Screenshot: Screenshothot

+5
source share

You can use a simple ListBox control and customize its ItemsPanel template and add a WrapPanel to it. WrapPanel places the elements in a horizontal tile layout where you can set its maximum width to include 3 elements in one line, and this will create more lines for 3 elements until the last one fills.

+3
source share

All Articles