Stack Layout Mode
- 3 minutes to read
When in Stack Layout mode, documents are organized into Stack Groups (StackGroup objects). You can think of Stack Groups as rows or columns of cards. Multiple Stack Groups can be created, allowing you to create multiple rows/columns of cards. The direction in which cards are arranged within Stack Groups is specified by the WidgetView.Orientation property.
Stack Groups are measured in either absolute or relative values. To set the width (for vertical oriented Widget View) or height (for horizontal oriented View) of a Stack Group, access its Length property that returns an object of the Length type. This object provides two properties: Length.UnitType and Length.UnitValue.
If the Length.UnitType property is set to Pixel, an integer value stored within the Length.UnitValue property is the width (height) of the related Stack Group in pixels. The following figure illustrates three Stack Groups with lengths of 60, 80 and 100 pixels. The View is oriented horizontally.
If the Length.UnitType property equals Star, an integer value stored within the Length.UnitValue property is a multiplier that specifies how much wider or narrower this Group is compared to other star-measured Groups. For instance, at the figure below a vertically-oriented Widget View contains three star-measured Stack Groups. Group lengths are set to 1, 2 and 3 respectively, so the second group is twice and the third group is three times as wide as the first group. This ratio persists when an end-user resizes the parent form.
A star-measured Stack Group does not have a constant length. Instead, its length adapts to the available space. For this reason, when an end-user resizes the parent form, Stack Groups can become narrower, clipping the content of their Documents. If a document content does not have a MinimumSize property specified, Groups can be resized until the content is no longer displayed. Otherwise, if a document content has a specified MinimumSize, Groups can only be resized until they reach this size. If they are resized any further, the Stack Group and its Documents will be hidden. You can expand the following sections to see animations that illustrate both of these behaviors.
Resizing Stack Groups without the content's minimum size specified
Resizing Stack Groups with the content's minimum size specified
When a star-measured Stack Group is hidden, its IsVisible property is set to false, and the VisibilityChanged event is raised. Pixel-measured Stack Groups are always visible.
End-users can drag widgets from one Stack Group to another. The number of child documents within a Stack Group cannot exceed the number specified by the IStackGroupDefaultProperties.Capacity property. Dragging a document fires the WidgetView.BeginDragging, WidgetView.Dragging and WidgetView.EndDragging events in sequence.
It is also possible to swap entire groups by dragging their captions. To enable this behavior, set the IStackGroupProperties.AllowDragging property to true and provide caption strings for your Stack Groups by using the StackGroup.Caption property.