Version

CompactWrapPanel Class

A custom wrap panel used to arrange items horizontally or vertically in as few columns as possible.
Syntax
'Declaration
 
Public Class CompactWrapPanel 
   Inherits System.Windows.Controls.Panel
public class CompactWrapPanel : System.Windows.Controls.Panel 
Remarks

The CompactWrapPanel is a specialized type of WrapPanel that will fit as many items as possible into a single "row" down to the MinItemExtent. The items are arranged based on the Orientation so they will be arranged from left to right when set to Horizontal and from top to bottom when set to Vertical. The number of items on each row is based on the extent with which the panel is measured in comparison to the MinItemExtent (and also considering the spacing between the items - InterItemSpacingX and InterItemSpacingY). So for example if the Orientation is set to Horizontal, the MinItemExtent is set to 100, the InterItemSpacingX is 0, there are 5 visible items in the Children collection and the panel is measured with width of 360, the items will be arranged horizontally such that 3 items (with a width of 120 since they must be at least 100 pixels) in the first row and 2 items (with a width of 180) in the second row. As the width decreased to 300 and increased to 400, the width of the items would decrease/increase respectively. If the panel is resized beyond that range, the items will be rearranged. For example, if the panel was then resized to 400 pixels, there would be 4 items in the first row (with a width of 100 pixels) and 1 item in the last row (with a width of 400 pixels).

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