ViewComponentContext Class

A context for view components.

Namespace
Microsoft.AspNetCore.Mvc.ViewComponents
Assemblies
  • Microsoft.AspNetCore.Mvc.ViewFeatures

Syntax

public class ViewComponentContext
class Microsoft.AspNetCore.Mvc.ViewComponents.ViewComponentContext

Constructors

ViewComponentContext()

Creates a new Microsoft.AspNetCore.Mvc.ViewComponents.ViewComponentContext.

public ViewComponentContext()
ViewComponentContext(Microsoft.AspNetCore.Mvc.ViewComponents.ViewComponentDescriptor, System.Collections.Generic.IDictionary<System.String, System.Object>, System.Text.Encodings.Web.HtmlEncoder, Microsoft.AspNetCore.Mvc.Rendering.ViewContext, System.IO.TextWriter)

Creates a new Microsoft.AspNetCore.Mvc.ViewComponents.ViewComponentContext.

Arguments:
public ViewComponentContext(ViewComponentDescriptor viewComponentDescriptor, IDictionary<string, object> arguments, HtmlEncoder htmlEncoder, ViewContext viewContext, TextWriter writer)

Properties

Microsoft.AspNetCore.Mvc.ViewComponents.ViewComponentContext.Arguments

Gets or sets the view component arguments.

Return type:System.Collections.Generic.IDictionary<System.String>
public IDictionary<string, object> Arguments { get; set; }
Microsoft.AspNetCore.Mvc.ViewComponents.ViewComponentContext.HtmlEncoder

Gets or sets the System.Text.Encodings.Web.HtmlEncoder.

Return type:System.Text.Encodings.Web.HtmlEncoder
public HtmlEncoder HtmlEncoder { get; set; }
Microsoft.AspNetCore.Mvc.ViewComponents.ViewComponentContext.ViewComponentDescriptor

Gets or sets the Microsoft.AspNetCore.Mvc.ViewComponents.ViewComponentDescriptor for the view component being invoked.

Return type:Microsoft.AspNetCore.Mvc.ViewComponents.ViewComponentDescriptor
public ViewComponentDescriptor ViewComponentDescriptor { get; set; }
Microsoft.AspNetCore.Mvc.ViewComponents.ViewComponentContext.ViewContext

Gets or sets the Microsoft.AspNetCore.Mvc.Rendering.ViewContext.

Return type:Microsoft.AspNetCore.Mvc.Rendering.ViewContext
public ViewContext ViewContext { get; set; }
Microsoft.AspNetCore.Mvc.ViewComponents.ViewComponentContext.ViewData

Gets the Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary.

Return type:Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary
public ViewDataDictionary ViewData { get; }
Microsoft.AspNetCore.Mvc.ViewComponents.ViewComponentContext.Writer

Gets the System.IO.TextWriter for output.

Return type:System.IO.TextWriter
public TextWriter Writer { get; }