Examples in this group show how to use classes in the GrapeCity.Documents.Layout.Composition namespace to create complex and flexible constraint-based layouts with custom z-order and clipping. The following "back-end" layout classes work with composition "front-end" classes listed above: Typical steps to create a layout:
  1. Create a Surface that will contain the layout.
  2. Use the Surface to create one or more Views. Each View has size and transform matrix.
  3. Add visuals or spaces to the View(s):
    • Use the View(s) to create one or more Visuals. A Visual usually has an associated LayoutRect. The constraints must unambiguously determine the rectangle's size and position, otherwise an error will occur. If the Visual has no LayoutRect, it is used to draw on anchor points in the View's coordinate system.
    • Or, if you need to add constraint-defined blank spaces to a View, use the View to add Space objects. A Space is basically a Visual without a Draw method. Note that a Space is not a container, its only purpose is to add spacing.
  4. Specify constraints on each Visual's and Space's LayoutRect. Constraints are relative to other Visuals in the same View, or relative to the View itself. The only exception is that constraints can be specified relative to an AnchorPoint in another View, or relative to a Contour in another View.
GrapeCity.Documents.Layout.Composition examples: