Aligning contents of LayoutItems

  • 2 minutes to read

Across-Group Alignment

Layout items are objects that associate labels with controls. The LayoutControl automatically aligns its layout items: the left edges of the item's content regions are aligned to the largest label in all the layout items:

CD_AlignItems_AlignWithinGroup

The LayoutControl aligns its layout items to the largest label in multiple groups.

CD_AlignItems_AlignAcrossGroups2

The following image demonstrates layout groups that are arranged in two columns. The LayoutControl aligns its layout items with the same horizontal offset to the largest item label.

CD_AlignItems_AlignAcrossGroups_TwoColumns

NOTE

The LayoutControl can align only items inside it or its groups, and it cannot align nested items' content. For example, if you place a UserControl with items into LayoutControl, or nest a LayoutItem in another one, the internal items are not aligned.

Local Alignment

You can make LayoutControl align its items within an individual group separately from other groups. Set the LayoutGroup.ItemLabelsAlignment property to Local to align items in this group separately from other groups.

In the following image, Group 2's LayoutGroup.ItemLabelsAlignment property is set to Local. The Group 2's items are aligned to the largest label within this group. The other groups' items are aligned to the largest label within these groups.

CD_AlignItems_AlignAcrossGroups_GroupAlignScope

NOTE

The LayoutControl does not align Layout items whose LayoutItem.Label property is not specified.