Skip to content

Row

Draws a collection of elements horizontally.

It supports paging functionality, allowing content to flow naturally across multiple pages when needed. When required, child items are split across pages, ensuring that the content is not cut off.

Item Types

For a row element with a width of 100 points that has three items (a relative item of size 1, a relative item of size 5, and a constant item of size 10 points), the items will occupy sizes of 15 points, 75 points, and 10 points respectively.

MethodDescription
ConstantItemAdds a new item to the row element with a specified constant size.
RelativeItemAdds a new item to the row element. This item occupies space proportionally to other relative items.
AutoItemAdds a new item to the row element. The size of this item adjusts based on its content.

For ConstantItem, you can optionally specify the unit value (default is Unit.Points).

c#
row.ConstantItem(5, Unit.Centimetre);

TIP

Learn more about supported units in the Lenght unit types section.

Basic usage

The Row element uses a lambda function to define its content. Inside the lambda, you can add multiple items using the Item method.

c#
container
    .Padding(25)
    .Width(325)
    .Row(row =>
    {
        row.ConstantItem(100)
            .Background(Colors.Grey.Medium)
            .Padding(10)
            .Text("100pt");

        row.RelativeItem()
            .Background(Colors.Grey.Lighten1)
            .Padding(10)
            .Text("75pt");

        row.RelativeItem(2)
            .Background(Colors.Grey.Lighten2)
            .Padding(10)
            .Text("150pt");
    });

example

Spacing

You can adjust the horizontal spacing between items using the Spacing method.

c#
container
    .Padding(25)
    .Width(220)
    .Height(50)
    .Row(row =>
    {
        row.Spacing(10);

        row.RelativeItem(2).Background(Colors.Grey.Darken1);
        row.RelativeItem(3).Background(Colors.Grey.Medium);
        row.RelativeItem(5).Background(Colors.Grey.Lighten1);
    });

example


Optionally, you can specify the unit value (default is Unit.Points).

c#
row.Spacing(5, Unit.Millimeters);

TIP

Learn more about supported units in the Lenght unit types section.

Released under the MIT License