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: - viewComponentDescriptor (Microsoft.AspNetCore.Mvc.ViewComponents.ViewComponentDescriptor) – The
Microsoft.AspNetCore.Mvc.ViewComponents.ViewComponentContext
for the view component being invoked. - arguments (System.Collections.Generic.IDictionary<System.String>) – The view component arguments.
- htmlEncoder (System.Text.Encodings.Web.HtmlEncoder) – The
Microsoft.AspNetCore.Mvc.ViewComponents.ViewComponentContext.HtmlEncoder
to use. - viewContext (Microsoft.AspNetCore.Mvc.Rendering.ViewContext) – The
Microsoft.AspNetCore.Mvc.ViewComponents.ViewComponentContext.ViewContext
. - writer (System.IO.TextWriter) – The
System.IO.TextWriter
for writing output.
public ViewComponentContext(ViewComponentDescriptor viewComponentDescriptor, IDictionary<string, object> arguments, HtmlEncoder htmlEncoder, ViewContext viewContext, TextWriter writer)
- viewComponentDescriptor (Microsoft.AspNetCore.Mvc.ViewComponents.ViewComponentDescriptor) – The
-
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; }
-