ComponentParameterCollectionBuilder<TComponent> Class
Sets the parameters of a component, with the names of its properties checked by the compiler.
public sealed class ComponentParameterCollectionBuilder<TComponent> where TComponent : IComponentType parameters
TComponent- The type of the component.
Methods
| Name | Description |
|---|---|
| Add(Expression<Func<TComponent, EventCallback>>, Action) | Sets an EventCallback parameter. |
| Add(Expression<Func<TComponent, EventCallback>>, Func<Task>) | Sets an EventCallback parameter to an asynchronous callback. The component awaits its task, so the host waits until the callback completes (an async lambda selects this overload, not the Action one). |
| Add(Expression<Func<TComponent, RenderFragment?>>, string) | Sets a RenderFragment parameter from markup. |
| Add(string, object?) | Sets a parameter by name, for instance an attribute captured by CaptureUnmatchedValues. |
| Add<TValue>(Expression<Func<TComponent, EventCallback<TValue>>>, Action<TValue>) | Sets an EventCallback<TValue> parameter. |
| Add<TValue>(Expression<Func<TComponent, EventCallback<TValue>>>, Func<TValue, Task>) | Sets an EventCallback<TValue> parameter to an asynchronous callback. The component awaits its task, so the host waits until the callback completes. |
| Add<TValue>(Expression<Func<TComponent, TValue>>, TValue) | Sets a parameter. |
| AddChildContent(RenderFragment) | Sets the ChildContent parameter. |
| AddChildContent(string) | Sets the ChildContent parameter from markup. |
Add overloads
Add(Expression<Func<TComponent, EventCallback>>, Action)
ComponentParameterCollectionBuilder.csSets an EventCallback parameter.
public ComponentParameterCollectionBuilder<TComponent> Add(Expression<Func<TComponent, EventCallback>> parameter, Action callback)Parameters
parameterExpression<Func<TComponent, EventCallback>>- The property of the parameter (
c => c.OnClick). callbackAction- The callback.
Returns
ComponentParameterCollectionBuilder<TComponent> The builder.
Add(Expression<Func<TComponent, EventCallback>>, Func<Task>)
ComponentParameterCollectionBuilder.csSets an EventCallback parameter to an asynchronous callback. The component awaits its task, so the host waits until the callback completes (an async lambda selects this overload, not the Action one).
public ComponentParameterCollectionBuilder<TComponent> Add(Expression<Func<TComponent, EventCallback>> parameter, Func<Task> callback)Parameters
parameterExpression<Func<TComponent, EventCallback>>- The property of the parameter (
c => c.OnClick). callbackFunc<Task>- The callback.
Returns
ComponentParameterCollectionBuilder<TComponent> The builder.
Add(Expression<Func<TComponent, RenderFragment?>>, string)
ComponentParameterCollectionBuilder.csSets a RenderFragment parameter from markup.
public ComponentParameterCollectionBuilder<TComponent> Add(Expression<Func<TComponent, RenderFragment?>> parameter, string markup)Parameters
parameterExpression<Func<TComponent, RenderFragment?>>- The property of the parameter (
c => c.ChildContent). markupstring- The HTML of the fragment.
Returns
ComponentParameterCollectionBuilder<TComponent> The builder.
Add(string, object?)
ComponentParameterCollectionBuilder.csSets a parameter by name, for instance an attribute captured by CaptureUnmatchedValues.
public ComponentParameterCollectionBuilder<TComponent> Add(string name, object? value)Add<TValue>(Expression<Func<TComponent, EventCallback<TValue>>>, Action<TValue>)
ComponentParameterCollectionBuilder.csSets an EventCallback<TValue> parameter.
public ComponentParameterCollectionBuilder<TComponent> Add<TValue>(Expression<Func<TComponent, EventCallback<TValue>>> parameter, Action<TValue> callback)Type parameters
TValue- The type of the argument of the callback.
Parameters
parameterExpression<Func<TComponent, EventCallback<TValue>>>- The property of the parameter (
c => c.ValueChanged). callbackAction<TValue>- The callback.
Returns
ComponentParameterCollectionBuilder<TComponent> The builder.
Add<TValue>(Expression<Func<TComponent, EventCallback<TValue>>>, Func<TValue, Task>)
ComponentParameterCollectionBuilder.csSets an EventCallback<TValue> parameter to an asynchronous callback. The component awaits its task, so the host waits until the callback completes.
public ComponentParameterCollectionBuilder<TComponent> Add<TValue>(Expression<Func<TComponent, EventCallback<TValue>>> parameter, Func<TValue, Task> callback)Type parameters
TValue- The type of the argument of the callback.
Parameters
parameterExpression<Func<TComponent, EventCallback<TValue>>>- The property of the parameter (
c => c.ValueChanged). callbackFunc<TValue, Task>- The callback.
Returns
ComponentParameterCollectionBuilder<TComponent> The builder.
Add<TValue>(Expression<Func<TComponent, TValue>>, TValue)
ComponentParameterCollectionBuilder.csSets a parameter.
public ComponentParameterCollectionBuilder<TComponent> Add<TValue>(Expression<Func<TComponent, TValue>> parameter, TValue value)Type parameters
TValue- The type of the parameter.
Parameters
parameterExpression<Func<TComponent, TValue>>- The property of the parameter (
c => c.Title). valueTValue- The value.
Returns
ComponentParameterCollectionBuilder<TComponent> The builder.
AddChildContent overloads
AddChildContent(RenderFragment)
ComponentParameterCollectionBuilder.csSets the ChildContent parameter.
public ComponentParameterCollectionBuilder<TComponent> AddChildContent(RenderFragment childContent)Parameters
childContentRenderFragment- The content.
Returns
ComponentParameterCollectionBuilder<TComponent> The builder.
AddChildContent(string)
ComponentParameterCollectionBuilder.csSets the ChildContent parameter from markup.
public ComponentParameterCollectionBuilder<TComponent> AddChildContent(string markup)Parameters
markupstring- The HTML of the content.
Returns
ComponentParameterCollectionBuilder<TComponent> The builder.