Class ViewComponentComponentRenderer

Version: 21.x

An IComponentRenderer that will render View Components.

Inheritance

System.Object

ViewComponentComponentRenderer

Implements

IComponentRenderer

Namespace: Sitecore.AspNet.RenderingEngine.Rendering

Assembly: Sitecore.AspNet.RenderingEngine.dll
Syntax
public class ViewComponentComponentRenderer : Object, IComponentRenderer

Constructors

ViewComponentComponentRenderer(String)

Initializes a new instance of the ViewComponentComponentRenderer class.

Declaration
public ViewComponentComponentRenderer(string locator)
Parameters
TypeNameDescription
System.StringlocatorThe string to use when locating the View Component.

Methods

Describe(Predicate, String)

Creates an instance of a ComponentRendererDescriptor for the ViewComponentComponentRenderer class.

Declaration
public static ComponentRendererDescriptor Describe(Predicate<string> match, string locator)
Parameters
TypeNameDescription
System.Predicate

<

System.String

>
matchA predicate to use when attempting to match a layout component.
System.StringlocatorThe string to use when locating the View Component.
Returns
TypeDescription
ComponentRendererDescriptorAn instance of ComponentRendererDescriptor.

Render(ISitecoreRenderingContext, ViewContext)

Generates the output HTML.

Declaration
public Task<IHtmlContent> Render(ISitecoreRenderingContext renderingContext, ViewContext viewContext)
Parameters
TypeNameDescription
ISitecoreRenderingContextrenderingContextThe current ISitecoreRenderingContext.
Microsoft.AspNetCore.Mvc.Rendering.ViewContextviewContextThe current Microsoft.AspNetCore.Mvc.Rendering.ViewContext.
Returns
TypeDescription
System.Threading.Tasks.Task

<

Microsoft.AspNetCore.Html.IHtmlContent

>
The HTML content to render.

Implements

IComponentRenderer

If you have suggestions for improving this article, let us know!