Example #1
0
        internal void InstantiateChildComponentOnFrame(ref RenderTreeFrame frame)
        {
            if (frame.FrameType != RenderTreeFrameType.Component)
            {
                throw new ArgumentException($"The frame's {nameof(RenderTreeFrame.FrameType)} property must equal {RenderTreeFrameType.Component}", nameof(frame));
            }

            if (frame.Component != null)
            {
                throw new ArgumentException($"The frame already has a non-null component instance", nameof(frame));
            }

            var newComponent   = InstantiateComponent(frame.ComponentType);
            var newComponentId = AssignComponentId(newComponent);

            frame = frame.WithComponentInstance(newComponentId, newComponent);
        }