Class ViewComponentComponentRenderer
An IComponentRenderer that will render View Components.
Inheritance
System.Object
ViewComponentComponentRenderer
Implements
Namespace: Sitecore.AspNet.RenderingEngine.Rendering
Assembly: Sitecore.AspNet.RenderingEngine.dll
Syntax
public class ViewComponentComponentRenderer : Object, IComponentRenderer
Constructors
ViewComponentComponentRenderer(IViewComponentHelper, String)
Initializes a new instance of the ViewComponentComponentRenderer class.
Declaration
public ViewComponentComponentRenderer(IViewComponentHelper viewComponentHelper, string locator)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.AspNetCore.Mvc.IViewComponentHelper | viewComponentHelper | The Microsoft.AspNetCore.Mvc.IViewComponentHelper to use for rendering. |
System.String | locator | The string to use when locating the View Component. |
Methods
Describe(Predicate<String>, String)
Creates an instance of a ComponentRendererDescriptor for the ViewComponentComponentRenderer class.
Declaration
public static ComponentRendererDescriptor Describe(Predicate<string> match, string locator)
Parameters
Type | Name | Description |
---|---|---|
System.Predicate<System.String> | match | A predicate to use when attempting to match a layout component. |
System.String | locator | The string to use when locating the View Component. |
Returns
Type | Description |
---|---|
ComponentRendererDescriptor | An instance of ComponentRendererDescriptor. |
Render(ISitecoreRenderingContext, ViewContext)
Generates the output HTML.
Declaration
public Task<IHtmlContent> Render(ISitecoreRenderingContext renderingContext, ViewContext viewContext)
Parameters
Type | Name | Description |
---|---|---|
ISitecoreRenderingContext | renderingContext | The current ISitecoreRenderingContext. |
Microsoft.AspNetCore.Mvc.Rendering.ViewContext | viewContext | The current Microsoft.AspNetCore.Mvc.Rendering.ViewContext. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<Microsoft.AspNetCore.Html.IHtmlContent> | The HTML content to render. |