Version

GalleryWrapPanel Class

A custom panel that positions items from left to right breaking to a new line based on the constraining width.
Syntax
'Declaration
 
Public Class GalleryWrapPanel 
   Inherits System.Windows.Controls.Panel
public class GalleryWrapPanel : System.Windows.Controls.Panel 
Remarks

The GalleryWrapPanel is a custom panel that arranges items from left to right wrapping to the next line when there is not enough room to fit the remaining items. The panel will position the items in at least as many columns as specified by the MinColumns regardless of space and will likely use at most MaxColumns even if there is more than enough space. You may control how many columns a single item will span using the SetColumnSpan attached property.

The widths of the columns and the heights of the rows are uniform. By default, the height of a row is based on the height of the largest item in the panel. The default width of a row is calculated based on the width of the largest item taking their ColumnSpanProperty into account. You may force an explicit size for the column width and row height using the ColumnWidth and RowHeight properties respectively. You may control the amount of spacing between columns using the ColumnSpacing.

Note: If the MinColumns is less than the largest ColumnSpanProperty value item for an item in the panel then the maximum ColumnSpanProperty value will be used as the minimum. Likewise, if the MaxColumns is less than the largest ColumnSpanProperty then the value of that largest ColumnSpanProperty will be used as the maximum number of columns.

Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also