public PageLayout( PageElementDependencies dependencies, PageElement parent, ILayout layout, IEnumerable <Tuple <string, IRegion, IElement> > regionElements, IPageData pageData) : base(dependencies, parent, layout, pageData) { pageData.BeginAddElement(Element); _regions = dependencies.DictionaryFactory.Create <string, PageRegion>(); var regionElementList = regionElements == null ? new List <Tuple <string, IRegion, IElement> >() : regionElements.ToList(); foreach (var regionName in layout.GetRegionNames()) { var name = regionName; var regionElement = regionElementList.FirstOrDefault( re => string.Equals(re.Item1, name, StringComparison.OrdinalIgnoreCase)); var region = regionElement == null?layout.GetRegion(name) : regionElement.Item2; var element = regionElement == null?layout.GetElement(name) : regionElement.Item3; var pageRegion = new PageRegion(dependencies, this, region, element, pageData); _regions[regionName] = pageRegion; } Children = _regions.Values.ToArray(); pageData.EndAddElement(Element); }