Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Share free space in a WrapPanel

Tags:

wpf

wrappanel

I'm using a WrapPanel in WPF to display images. When resizing the form, these images are trying to take the maximum of the free spaces but when the picture can almost fill the space, there is a relatively big gap at the end of the WrapPanel. What I would like to do is to share this space between the images before a new one fills this gap (like what Windows 7 Explorer is doing when displaying image icons).

like image 650
Sébastien Avatar asked May 31 '11 18:05

Sébastien


1 Answers

Lookout code of BalancedWrapPanel for WPF in this article.

Or you may calculate Margin for Images how ((Width of WrapPanel) - (summ Width of Images)) / (Images count) and set this Margin property for Image type in WrapPanel Resources.

like image 133
Sonorx Avatar answered Oct 10 '22 18:10

Sonorx