diff --git a/QuestPDF.Examples/ElementExamples.cs b/QuestPDF.Examples/ElementExamples.cs index 8799675..37ce1fb 100644 --- a/QuestPDF.Examples/ElementExamples.cs +++ b/QuestPDF.Examples/ElementExamples.cs @@ -24,7 +24,7 @@ namespace QuestPDF.Examples container .Background("#FFF") .Padding(25) - .Section(section => + .Decoration(section => { section .Header() @@ -81,12 +81,12 @@ namespace QuestPDF.Examples .Padding(20) .Stack(stack => { - stack.Element() + stack.Item() .PaddingBottom(10) .AlignCenter() .Text("This Row element is 700pt wide"); - stack.Element().Row(row => + stack.Item().Row(row => { row.ConstantColumn(100) .Background("#DDD") @@ -119,17 +119,17 @@ namespace QuestPDF.Examples column.Spacing(10); column - .Element() + .Item() .Background("#999") .Height(50); column - .Element() + .Item() .Background("#BBB") .Height(100); column - .Element() + .Item() .Background("#DDD") .Height(150); }); @@ -203,8 +203,8 @@ namespace QuestPDF.Examples layers.PrimaryLayer().Stack(stack => { - stack.Element().PaddingTop(20).Text("Text 1"); - stack.Element().PaddingTop(40).Text("Text 2"); + stack.Item().PaddingTop(20).Text("Text 1"); + stack.Item().PaddingTop(40).Text("Text 2"); }); layers.Layer().Canvas((canvas, size) => diff --git a/QuestPDF.Examples/FrameExample.cs b/QuestPDF.Examples/FrameExample.cs index ff2af3d..52d82fd 100644 --- a/QuestPDF.Examples/FrameExample.cs +++ b/QuestPDF.Examples/FrameExample.cs @@ -32,7 +32,7 @@ namespace QuestPDF.Examples { for(var i=1; i<=4; i++) { - stack.Element().Row(row => + stack.Item().Row(row => { row.RelativeColumn(2).LabelCell().Text(Placeholders.Label()); row.RelativeColumn(3).ValueCell().Text(Placeholders.Paragraph()); diff --git a/QuestPDF.Examples/LoremPicsumExample.cs b/QuestPDF.Examples/LoremPicsumExample.cs index d629beb..184090e 100644 --- a/QuestPDF.Examples/LoremPicsumExample.cs +++ b/QuestPDF.Examples/LoremPicsumExample.cs @@ -41,11 +41,11 @@ namespace QuestPDF.Examples column.Spacing(10); column - .Element() + .Item() .Component(new LoremPicsum(true)); column - .Element() + .Item() .AlignRight() .Text("From Lorem Picsum"); }); diff --git a/QuestPDF.Examples/Padding.cs b/QuestPDF.Examples/Padding.cs index 57fa6c8..0a7424a 100644 --- a/QuestPDF.Examples/Padding.cs +++ b/QuestPDF.Examples/Padding.cs @@ -43,7 +43,7 @@ namespace QuestPDF.Examples .Stack(column => { column - .Element() + .Item() .Height(100) .Background("#FFF") @@ -55,7 +55,7 @@ namespace QuestPDF.Examples .Background("#444"); column - .Element() + .Item() .Height(100) .Background("#DDD") @@ -67,7 +67,7 @@ namespace QuestPDF.Examples .Background("#222"); column - .Element() + .Item() .Height(100) .Background("#BBB") @@ -86,7 +86,7 @@ namespace QuestPDF.Examples .Stack(column => { column - .Element() + .Item() .Height(150) .Row(row => { @@ -108,7 +108,7 @@ namespace QuestPDF.Examples }); column - .Element() + .Item() .Height(150) .Row(row => { diff --git a/QuestPDF.ReportSample/Layouts/PhotoTemplate.cs b/QuestPDF.ReportSample/Layouts/PhotoTemplate.cs index 5f703a8..515c813 100644 --- a/QuestPDF.ReportSample/Layouts/PhotoTemplate.cs +++ b/QuestPDF.ReportSample/Layouts/PhotoTemplate.cs @@ -20,8 +20,8 @@ namespace QuestPDF.ReportSample.Layouts .Stack(stack => { stack.Spacing(5); - stack.Element(PhotoWithMaps); - stack.Element(PhotoDetails); + stack.Item(PhotoWithMaps); + stack.Item(PhotoDetails); }); } @@ -36,8 +36,8 @@ namespace QuestPDF.ReportSample.Layouts { stack.Spacing(7f); - stack.Element().AspectRatio(4 / 3f).Image(Placeholders.Image); - stack.Element().AspectRatio(4 / 3f).Image(Placeholders.Image); + stack.Item().AspectRatio(4 / 3f).Image(Placeholders.Image); + stack.Item().AspectRatio(4 / 3f).Image(Placeholders.Image); }); }); } diff --git a/QuestPDF.ReportSample/Layouts/SectionTemplate.cs b/QuestPDF.ReportSample/Layouts/SectionTemplate.cs index 0bc3582..197eca1 100644 --- a/QuestPDF.ReportSample/Layouts/SectionTemplate.cs +++ b/QuestPDF.ReportSample/Layouts/SectionTemplate.cs @@ -17,7 +17,7 @@ namespace QuestPDF.ReportSample.Layouts { container .EnsureSpace() - .Section(section => + .Decoration(section => { section .Header() @@ -28,7 +28,7 @@ namespace QuestPDF.ReportSample.Layouts { foreach (var part in Model.Parts) { - stack.Element().Row(row => + stack.Item().Row(row => { row.ConstantColumn(150).LabelCell().Text(part.Label, Typography.Normal); var frame = row.RelativeColumn().ValueCell(); @@ -59,8 +59,8 @@ namespace QuestPDF.ReportSample.Layouts { stack.Spacing(5); - stack.Element().MaxWidth(250).AspectRatio(4 / 3f).Image(Placeholders.Image); - stack.Element().Text(model.Location.Format(), Typography.Normal); + stack.Item().MaxWidth(250).AspectRatio(4 / 3f).Image(Placeholders.Image); + stack.Item().Text(model.Location.Format(), Typography.Normal); }); } diff --git a/QuestPDF.ReportSample/Layouts/StandardReport.cs b/QuestPDF.ReportSample/Layouts/StandardReport.cs index 70667c4..e6c43e9 100644 --- a/QuestPDF.ReportSample/Layouts/StandardReport.cs +++ b/QuestPDF.ReportSample/Layouts/StandardReport.cs @@ -40,7 +40,7 @@ namespace QuestPDF.ReportSample.Layouts { container.Stack(stack => { - stack.Element().Row(row => + stack.Item().Row(row => { row.Spacing(50); @@ -48,9 +48,9 @@ namespace QuestPDF.ReportSample.Layouts row.ConstantColumn(150).ExternalLink("https://www.questpdf.com").Image(Model.LogoData); }); - stack.Element().ShowOnce().PaddingVertical(15).Border(1f).BorderColor(Colors.Grey.Lighten1).ExtendHorizontal(); + stack.Item().ShowOnce().PaddingVertical(15).Border(1f).BorderColor(Colors.Grey.Lighten1).ExtendHorizontal(); - stack.Element().ShowOnce().Grid(grid => + stack.Item().ShowOnce().Grid(grid => { grid.Columns(2); grid.Spacing(5); @@ -59,8 +59,8 @@ namespace QuestPDF.ReportSample.Layouts { grid.Element().Stack(row => { - row.Element().AlignLeft().Text(field.Label, Typography.Normal.SemiBold()); - row.Element().Text(field.Value, Typography.Normal); + row.Item().AlignLeft().Text(field.Label, Typography.Normal.SemiBold()); + row.Item().Text(field.Value, Typography.Normal); }); } }); @@ -73,16 +73,16 @@ namespace QuestPDF.ReportSample.Layouts { stack.Spacing(20); - stack.Element().Component(new TableOfContentsTemplate(Model.Sections)); + stack.Item().Component(new TableOfContentsTemplate(Model.Sections)); foreach (var section in Model.Sections) - stack.Element().Location(section.Title).Component(new SectionTemplate(section)); + stack.Item().Location(section.Title).Component(new SectionTemplate(section)); - stack.Element().PageBreak(); - stack.Element().Location("Photos"); + stack.Item().PageBreak(); + stack.Item().Location("Photos"); foreach (var photo in Model.Photos) - stack.Element().Component(new PhotoTemplate(photo)); + stack.Item().Component(new PhotoTemplate(photo)); }); } } diff --git a/QuestPDF.ReportSample/Layouts/TableOfContentsTemplate.cs b/QuestPDF.ReportSample/Layouts/TableOfContentsTemplate.cs index 9fef731..47692db 100644 --- a/QuestPDF.ReportSample/Layouts/TableOfContentsTemplate.cs +++ b/QuestPDF.ReportSample/Layouts/TableOfContentsTemplate.cs @@ -16,7 +16,7 @@ namespace QuestPDF.ReportSample.Layouts public void Compose(IContainer container) { container - .Section(section => + .Decoration(section => { section .Header() @@ -28,9 +28,9 @@ namespace QuestPDF.ReportSample.Layouts stack.Spacing(5); for (var i = 0; i < Sections.Count; i++) - stack.Element(c => DrawLink(c, i+1, Sections[i].Title)); + stack.Item(c => DrawLink(c, i+1, Sections[i].Title)); - stack.Element(c => DrawLink(c, Sections.Count+1, "Photos")); + stack.Item(c => DrawLink(c, Sections.Count+1, "Photos")); }); }); } diff --git a/QuestPDF.UnitTests/DecorationTests.cs b/QuestPDF.UnitTests/DecorationTests.cs index f64cd4b..f89210e 100644 --- a/QuestPDF.UnitTests/DecorationTests.cs +++ b/QuestPDF.UnitTests/DecorationTests.cs @@ -15,7 +15,7 @@ namespace QuestPDF.UnitTests public void Measure_ReturnsWrap_WhenDecorationReturnsWrap() { TestPlan - .For(x => new Decoration + .For(x => new SimpleDecoration { Type = DecorationType.Append, DecorationElement = x.CreateChild("decoration"), @@ -30,7 +30,7 @@ namespace QuestPDF.UnitTests public void Measure_ReturnsWrap_WhenDecorationReturnsPartialRender() { TestPlan - .For(x => new Decoration + .For(x => new SimpleDecoration { Type = DecorationType.Append, DecorationElement = x.CreateChild("decoration"), @@ -45,7 +45,7 @@ namespace QuestPDF.UnitTests public void Measure_ReturnsWrap_WhenContentReturnsWrap() { TestPlan - .For(x => new Decoration + .For(x => new SimpleDecoration { Type = DecorationType.Append, DecorationElement = x.CreateChild("decoration"), @@ -61,7 +61,7 @@ namespace QuestPDF.UnitTests public void Measure_ReturnsPartialRender_WhenContentReturnsPartialRender() { TestPlan - .For(x => new Decoration + .For(x => new SimpleDecoration { Type = DecorationType.Append, DecorationElement = x.CreateChild("decoration"), @@ -77,7 +77,7 @@ namespace QuestPDF.UnitTests public void Measure_ReturnsFullRender_WhenContentReturnsFullRender() { TestPlan - .For(x => new Decoration + .For(x => new SimpleDecoration { Type = DecorationType.Append, DecorationElement = x.CreateChild("decoration"), @@ -97,7 +97,7 @@ namespace QuestPDF.UnitTests public void Draw_Prepend() { TestPlan - .For(x => new Decoration + .For(x => new SimpleDecoration { Type = DecorationType.Prepend, DecorationElement = x.CreateChild("decoration"), @@ -116,7 +116,7 @@ namespace QuestPDF.UnitTests public void Draw_Append() { TestPlan - .For(x => new Decoration + .For(x => new SimpleDecoration { Type = DecorationType.Append, DecorationElement = x.CreateChild("decoration"), diff --git a/QuestPDF.UnitTests/GridTests.cs b/QuestPDF.UnitTests/GridTests.cs index d7173c1..7da42c4 100644 --- a/QuestPDF.UnitTests/GridTests.cs +++ b/QuestPDF.UnitTests/GridTests.cs @@ -41,21 +41,21 @@ namespace QuestPDF.UnitTests expected.Stack(stack => { - stack.Element().Row(row => + stack.Item().Row(row => { row.RelativeColumn(6).Element(childA); row.RelativeColumn(4).Element(childB); row.RelativeColumn(2).Element(new Empty()); }); - stack.Element().Row(row => + stack.Item().Row(row => { row.RelativeColumn(4).Element(childC); row.RelativeColumn(2).Element(childD); row.RelativeColumn(6).Element(new Empty()); }); - stack.Element().Row(row => + stack.Item().Row(row => { row.RelativeColumn(8).Element(childE); row.RelativeColumn(4).Element(new Empty()); @@ -95,7 +95,7 @@ namespace QuestPDF.UnitTests expected.Stack(stack => { - stack.Element().Row(row => + stack.Item().Row(row => { row.RelativeColumn(1).Element(new Empty()); row.RelativeColumn(6).Element(childA); @@ -103,7 +103,7 @@ namespace QuestPDF.UnitTests row.RelativeColumn(1).Element(new Empty()); }); - stack.Element().Row(row => + stack.Item().Row(row => { row.RelativeColumn(3).Element(new Empty()); row.RelativeColumn(4).Element(childC); @@ -111,7 +111,7 @@ namespace QuestPDF.UnitTests row.RelativeColumn(3).Element(new Empty()); }); - stack.Element().Row(row => + stack.Item().Row(row => { row.RelativeColumn(2).Element(new Empty()); row.RelativeColumn(8).Element(childE); @@ -152,21 +152,21 @@ namespace QuestPDF.UnitTests expected.Container().Stack(stack => { - stack.Element().Row(row => + stack.Item().Row(row => { row.RelativeColumn(2).Element(new Empty()); row.RelativeColumn(6).Element(childA); row.RelativeColumn(4).Element(childB); }); - stack.Element().Row(row => + stack.Item().Row(row => { row.RelativeColumn(6).Element(new Empty()); row.RelativeColumn(4).Element(childC); row.RelativeColumn(2).Element(childD); }); - stack.Element().Row(row => + stack.Item().Row(row => { row.RelativeColumn(4).Element(new Empty()); row.RelativeColumn(8).Element(childE); diff --git a/QuestPDF.UnitTests/StackTests.cs b/QuestPDF.UnitTests/StackTests.cs index bcca9ce..0617fc7 100644 --- a/QuestPDF.UnitTests/StackTests.cs +++ b/QuestPDF.UnitTests/StackTests.cs @@ -197,9 +197,9 @@ namespace QuestPDF.UnitTests { stack.Spacing(0); - stack.Element(childA); - stack.Element(childB); - stack.Element(childC); + stack.Item().Element(childA); + stack.Item().Element(childB); + stack.Item().Element(childC); }); // assert @@ -207,9 +207,18 @@ namespace QuestPDF.UnitTests { Children = new List { - childA, - childB, - childC + new Container + { + Child = childA + }, + new Container + { + Child = childB + }, + new Container + { + Child = childC + } } }; @@ -232,9 +241,9 @@ namespace QuestPDF.UnitTests { stack.Spacing(100); - stack.Element(childA); - stack.Element(childB); - stack.Element(childC); + stack.Item().Element(childA); + stack.Item().Element(childB); + stack.Item().Element(childC); }); // assert @@ -248,17 +257,26 @@ namespace QuestPDF.UnitTests new Padding { Bottom = 100, - Child = childA + Child = new Container + { + Child = childA + } }, new Padding { Bottom = 100, - Child = childB + Child = new Container + { + Child = childB + } }, new Padding { Bottom = 100, - Child = childC + Child = new Container + { + Child = childC + } }, } } diff --git a/QuestPDF/Elements/Decoration.cs b/QuestPDF/Elements/Decoration.cs index 2338bbb..bef5762 100644 --- a/QuestPDF/Elements/Decoration.cs +++ b/QuestPDF/Elements/Decoration.cs @@ -1,62 +1,27 @@ -using System; -using QuestPDF.Drawing.SpacePlan; +using QuestPDF.Fluent; using QuestPDF.Infrastructure; namespace QuestPDF.Elements { - internal enum DecorationType + internal class Decoration : IComponent { - Prepend, - Append - } - - internal class Decoration : Element - { - public Element DecorationElement { get; set; } = new Empty(); - public Element ContentElement { get; set; } = new Empty(); - public DecorationType Type { get; set; } + public Element Header { get; set; } = new Empty(); + public Element Content { get; set; } = new Empty(); + public Element Footer { get; set; } = new Empty(); - internal override ISpacePlan Measure(Size availableSpace) + public void Compose(IContainer container) { - var decorationMeasure = DecorationElement?.Measure(availableSpace); - - if (decorationMeasure is Wrap || decorationMeasure is PartialRender) - return new Wrap(); - - var decorationSize = decorationMeasure as Size ?? Size.Zero; - var contentMeasure = ContentElement?.Measure(new Size(availableSpace.Width, availableSpace.Height - decorationSize.Height)) ?? new FullRender(Size.Zero); - - if (contentMeasure is Wrap) - return new Wrap(); - - var contentSize = contentMeasure as Size ?? Size.Zero; - var resultSize = new Size(availableSpace.Width, decorationSize.Height + contentSize.Height); - - if (contentSize is PartialRender) - return new PartialRender(resultSize); - - if (contentSize is FullRender) - return new FullRender(resultSize); - - throw new NotSupportedException(); - } - - internal override void Draw(ICanvas canvas, Size availableSpace) - { - var decorationSize = DecorationElement?.Measure(availableSpace) as Size ?? Size.Zero; - var contentSize = new Size(availableSpace.Width, availableSpace.Height - decorationSize.Height); - - var translateHeight = Type == DecorationType.Prepend ? decorationSize.Height : contentSize.Height; - Action drawDecoration = () => DecorationElement?.Draw(canvas, new Size(availableSpace.Width, decorationSize.Height)); - Action drawContent = () => ContentElement?.Draw(canvas, new Size (availableSpace.Width, contentSize.Height)); - - var first = Type == DecorationType.Prepend ? drawDecoration : drawContent; - var second = Type == DecorationType.Prepend ? drawContent : drawDecoration; - - first(); - canvas.Translate(new Position(0, translateHeight)); - second(); - canvas.Translate(new Position(0, -translateHeight)); + container.Element(new SimpleDecoration + { + Type = DecorationType.Prepend, + DecorationElement = Header, + ContentElement = new SimpleDecoration + { + Type = DecorationType.Append, + ContentElement = Content, + DecorationElement = Footer + } + }); } } } \ No newline at end of file diff --git a/QuestPDF/Elements/Grid.cs b/QuestPDF/Elements/Grid.cs index 790e82f..142313f 100644 --- a/QuestPDF/Elements/Grid.cs +++ b/QuestPDF/Elements/Grid.cs @@ -33,7 +33,7 @@ namespace QuestPDF.Elements stack.Spacing(HorizontalSpacing); while (ChildrenQueue.Any()) - stack.Element().Row(BuildRow); + stack.Item().Row(BuildRow); }); } diff --git a/QuestPDF/Elements/Page.cs b/QuestPDF/Elements/Page.cs index 2a87bdc..b0e5176 100644 --- a/QuestPDF/Elements/Page.cs +++ b/QuestPDF/Elements/Page.cs @@ -11,7 +11,7 @@ namespace QuestPDF.Elements public void Compose(IContainer container) { - container.Section(section => + container.Decoration(section => { section.Header().Element(Header); section.Content().Extend().Element(Content); diff --git a/QuestPDF/Elements/Section.cs b/QuestPDF/Elements/Section.cs deleted file mode 100644 index 01a851c..0000000 --- a/QuestPDF/Elements/Section.cs +++ /dev/null @@ -1,27 +0,0 @@ -using QuestPDF.Fluent; -using QuestPDF.Infrastructure; - -namespace QuestPDF.Elements -{ - internal class Section : IComponent - { - public Element Header { get; set; } = new Empty(); - public Element Content { get; set; } = new Empty(); - public Element Footer { get; set; } = new Empty(); - - public void Compose(IContainer container) - { - container.Element(new Decoration - { - Type = DecorationType.Prepend, - DecorationElement = Header, - ContentElement = new Decoration - { - Type = DecorationType.Append, - ContentElement = Content, - DecorationElement = Footer - } - }); - } - } -} \ No newline at end of file diff --git a/QuestPDF/Elements/SimpleDecoration.cs b/QuestPDF/Elements/SimpleDecoration.cs new file mode 100644 index 0000000..7c36bf5 --- /dev/null +++ b/QuestPDF/Elements/SimpleDecoration.cs @@ -0,0 +1,62 @@ +using System; +using QuestPDF.Drawing.SpacePlan; +using QuestPDF.Infrastructure; + +namespace QuestPDF.Elements +{ + internal enum DecorationType + { + Prepend, + Append + } + + internal class SimpleDecoration : Element + { + public Element DecorationElement { get; set; } = new Empty(); + public Element ContentElement { get; set; } = new Empty(); + public DecorationType Type { get; set; } + + internal override ISpacePlan Measure(Size availableSpace) + { + var decorationMeasure = DecorationElement?.Measure(availableSpace); + + if (decorationMeasure is Wrap || decorationMeasure is PartialRender) + return new Wrap(); + + var decorationSize = decorationMeasure as Size ?? Size.Zero; + var contentMeasure = ContentElement?.Measure(new Size(availableSpace.Width, availableSpace.Height - decorationSize.Height)) ?? new FullRender(Size.Zero); + + if (contentMeasure is Wrap) + return new Wrap(); + + var contentSize = contentMeasure as Size ?? Size.Zero; + var resultSize = new Size(availableSpace.Width, decorationSize.Height + contentSize.Height); + + if (contentSize is PartialRender) + return new PartialRender(resultSize); + + if (contentSize is FullRender) + return new FullRender(resultSize); + + throw new NotSupportedException(); + } + + internal override void Draw(ICanvas canvas, Size availableSpace) + { + var decorationSize = DecorationElement?.Measure(availableSpace) as Size ?? Size.Zero; + var contentSize = new Size(availableSpace.Width, availableSpace.Height - decorationSize.Height); + + var translateHeight = Type == DecorationType.Prepend ? decorationSize.Height : contentSize.Height; + Action drawDecoration = () => DecorationElement?.Draw(canvas, new Size(availableSpace.Width, decorationSize.Height)); + Action drawContent = () => ContentElement?.Draw(canvas, new Size (availableSpace.Width, contentSize.Height)); + + var first = Type == DecorationType.Prepend ? drawDecoration : drawContent; + var second = Type == DecorationType.Prepend ? drawContent : drawDecoration; + + first(); + canvas.Translate(new Position(0, translateHeight)); + second(); + canvas.Translate(new Position(0, -translateHeight)); + } + } +} \ No newline at end of file diff --git a/QuestPDF/Fluent/SectionExtensions.cs b/QuestPDF/Fluent/SectionExtensions.cs index 515b881..dd109b3 100644 --- a/QuestPDF/Fluent/SectionExtensions.cs +++ b/QuestPDF/Fluent/SectionExtensions.cs @@ -4,14 +4,14 @@ using QuestPDF.Infrastructure; namespace QuestPDF.Fluent { - public class SectionDescriptor + public class DecorationDescriptor { - internal Section Section { get; } = new Section(); + internal Decoration Decoration { get; } = new Decoration(); public IContainer Header() { var container = new Container(); - Section.Header = container; + Decoration.Header = container; return container; } @@ -23,7 +23,7 @@ namespace QuestPDF.Fluent public IContainer Content() { var container = new Container(); - Section.Content = container; + Decoration.Content = container; return container; } @@ -35,7 +35,7 @@ namespace QuestPDF.Fluent public IContainer Footer() { var container = new Container(); - Section.Footer = container; + Decoration.Footer = container; return container; } @@ -47,12 +47,12 @@ namespace QuestPDF.Fluent public static class SectionExtensions { - public static void Section(this IContainer element, Action handler) + public static void Decoration(this IContainer element, Action handler) { - var descriptor = new SectionDescriptor(); + var descriptor = new DecorationDescriptor(); handler(descriptor); - element.Component(descriptor.Section); + element.Component(descriptor.Decoration); } } } \ No newline at end of file diff --git a/QuestPDF/Fluent/StackExtensions.cs b/QuestPDF/Fluent/StackExtensions.cs index 2f34df8..1197163 100644 --- a/QuestPDF/Fluent/StackExtensions.cs +++ b/QuestPDF/Fluent/StackExtensions.cs @@ -8,7 +8,7 @@ namespace QuestPDF.Fluent { public class StackDescriptor { - private List Elements { get; } = new List(); + private List Items { get; } = new List(); private float StackSpacing { get; set; } = 0; public void Spacing(float value) @@ -16,35 +16,30 @@ namespace QuestPDF.Fluent StackSpacing = value; } - public IContainer Element() + public IContainer Item() { var container = new Container(); - Elements.Add(container); + Items.Add(container); return container; } - public void Element(Action handler) + public void Item(Action handler) { - handler?.Invoke(Element()); + handler?.Invoke(Item()); } - public void Element(IElement element) - { - Elements.Add(element as Element); - } - internal Element CreateStack() { - if (Elements.Count == 0) + if (Items.Count == 0) return new Empty(); if (StackSpacing <= Size.Epsilon) return new Stack { - Children = Elements + Children = Items }; - var children = Elements + var children = Items .Select(x => new Padding { Bottom = StackSpacing,