@@ -78,7 +78,7 @@ public ComponentParameterCollectionBuilder<TComponent> Add<TChildComponent>(Expr
78
78
/// <param name="parameterSelector">A lambda function that selects the parameter.</param>
79
79
/// <param name="markup">The markup string to pass to the <see cref="RenderFragment"/>.</param>
80
80
/// <returns>This <see cref="ComponentParameterCollectionBuilder{TComponent}"/>.</returns>
81
- public ComponentParameterCollectionBuilder < TComponent > Add ( Expression < Func < TComponent , RenderFragment ? > > parameterSelector , [ StringSyntax ( "Html" ) ] string markup )
81
+ public ComponentParameterCollectionBuilder < TComponent > Add ( Expression < Func < TComponent , RenderFragment ? > > parameterSelector , [ StringSyntax ( "Html" ) ] string markup )
82
82
=> Add ( parameterSelector , markup . ToMarkupRenderFragment ( ) ) ;
83
83
84
84
/// <summary>
@@ -266,7 +266,7 @@ public ComponentParameterCollectionBuilder<TComponent> AddChildContent(RenderFra
266
266
/// </summary>
267
267
/// <param name="markup">The markup string to pass the ChildContent parameter wrapped in a <see cref="RenderFragment"/>.</param>
268
268
/// <returns>This <see cref="ComponentParameterCollectionBuilder{TComponent}"/>.</returns>
269
- public ComponentParameterCollectionBuilder < TComponent > AddChildContent ( [ StringSyntax ( "Html" ) ] string markup )
269
+ public ComponentParameterCollectionBuilder < TComponent > AddChildContent ( [ StringSyntax ( "Html" ) ] string markup )
270
270
=> AddChildContent ( markup . ToMarkupRenderFragment ( ) ) ;
271
271
272
272
/// <summary>
@@ -344,11 +344,11 @@ public ComponentParameterCollectionBuilder<TComponent> Bind<TValue>(
344
344
Action < TValue > changedAction ,
345
345
Expression < Func < TValue > > ? valueExpression = null )
346
346
{
347
- #if ! NET8_0_OR_GREATER
347
+ #if ! NET8_0_OR_GREATER
348
348
var ( parameterName , _, isCascading ) = GetParameterInfo ( parameterSelector ) ;
349
- #else
349
+ #else
350
350
var ( parameterName , _, isCascading ) = GetParameterInfo ( parameterSelector , initialValue ) ;
351
- #endif
351
+ #endif
352
352
353
353
if ( isCascading )
354
354
throw new ArgumentException ( "Using Bind with a cascading parameter is not allowed." , parameterName ) ;
@@ -397,6 +397,19 @@ static string TrimEnd(string source, string value)
397
397
: source ;
398
398
}
399
399
400
+ #if NET9_0_OR_GREATER
401
+ /// <summary>
402
+ /// Sets (or unsets) the <see cref="IComponentRenderMode"/> for the component and child components.
403
+ /// </summary>
404
+ /// <param name="renderMode">The render mode to assign to the component, e.g. <c>RenderMode.InteractiveServer</c>, or <see langword="null"/>, to not assign a specific render mode.</param>
405
+ /// <returns>This <see cref="ComponentParameterCollectionBuilder{TComponent}"/>.</returns>
406
+ public ComponentParameterCollectionBuilder < TComponent > SetAssignedRenderMode ( IComponentRenderMode ? renderMode )
407
+ {
408
+ parameters . RenderMode = renderMode ;
409
+ return this ;
410
+ }
411
+ #endif
412
+
400
413
/// <summary>
401
414
/// Try to add a <paramref name="value"/> for a parameter with the <paramref name="name"/>, if
402
415
/// <typeparamref name="TComponent"/> has a property with that name, AND that property has a <see cref="ParameterAttribute"/>
@@ -454,14 +467,14 @@ Expression<Func<TComponent, TValue>> parameterSelector
454
467
: propInfoCandidate ;
455
468
456
469
var paramAttr = propertyInfo ? . GetCustomAttribute < ParameterAttribute > ( inherit : true ) ;
457
- #if ! NET8_0_OR_GREATER
470
+ #if ! NET8_0_OR_GREATER
458
471
var cascadingParamAttr = propertyInfo ? . GetCustomAttribute < CascadingParameterAttribute > ( inherit : true ) ;
459
472
460
473
if ( propertyInfo is null || ( paramAttr is null && cascadingParamAttr is null ) )
461
474
throw new ArgumentException ( $ "The parameter selector '{ parameterSelector } ' does not resolve to a public property on the component '{ typeof ( TComponent ) } ' with a [Parameter] or [CascadingParameter] attribute.", nameof ( parameterSelector ) ) ;
462
475
463
476
return ( propertyInfo . Name , CascadingValueName : cascadingParamAttr ? . Name , IsCascading : cascadingParamAttr is not null ) ;
464
- #else
477
+ #else
465
478
var cascadingParamAttrBase = propertyInfo ? . GetCustomAttribute < CascadingParameterAttributeBase > ( inherit : true ) ;
466
479
467
480
if ( propertyInfo is null || ( paramAttr is null && cascadingParamAttrBase is null ) )
@@ -494,7 +507,7 @@ static ArgumentException CreateErrorMessageForSupplyFromQuery(
494
507
NavigationManager.NavigateTo(uri);
495
508
""" ) ;
496
509
}
497
- #endif
510
+ #endif
498
511
}
499
512
500
513
private static bool HasChildContentParameter ( )
0 commit comments