@@ -78,7 +78,7 @@ public ComponentParameterCollectionBuilder<TComponent> Add<TChildComponent>(Expr
7878 /// <param name="parameterSelector">A lambda function that selects the parameter.</param>
7979 /// <param name="markup">The markup string to pass to the <see cref="RenderFragment"/>.</param>
8080 /// <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 )
8282 => Add ( parameterSelector , markup . ToMarkupRenderFragment ( ) ) ;
8383
8484 /// <summary>
@@ -266,7 +266,7 @@ public ComponentParameterCollectionBuilder<TComponent> AddChildContent(RenderFra
266266 /// </summary>
267267 /// <param name="markup">The markup string to pass the ChildContent parameter wrapped in a <see cref="RenderFragment"/>.</param>
268268 /// <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 )
270270 => AddChildContent ( markup . ToMarkupRenderFragment ( ) ) ;
271271
272272 /// <summary>
@@ -344,11 +344,11 @@ public ComponentParameterCollectionBuilder<TComponent> Bind<TValue>(
344344 Action < TValue > changedAction ,
345345 Expression < Func < TValue > > ? valueExpression = null )
346346 {
347- #if ! NET8_0_OR_GREATER
347+ #if ! NET8_0_OR_GREATER
348348 var ( parameterName , _, isCascading ) = GetParameterInfo ( parameterSelector ) ;
349- #else
349+ #else
350350 var ( parameterName , _, isCascading ) = GetParameterInfo ( parameterSelector , initialValue ) ;
351- #endif
351+ #endif
352352
353353 if ( isCascading )
354354 throw new ArgumentException ( "Using Bind with a cascading parameter is not allowed." , parameterName ) ;
@@ -397,6 +397,19 @@ static string TrimEnd(string source, string value)
397397 : source ;
398398 }
399399
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+
400413 /// <summary>
401414 /// Try to add a <paramref name="value"/> for a parameter with the <paramref name="name"/>, if
402415 /// <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
454467 : propInfoCandidate ;
455468
456469 var paramAttr = propertyInfo ? . GetCustomAttribute < ParameterAttribute > ( inherit : true ) ;
457- #if ! NET8_0_OR_GREATER
470+ #if ! NET8_0_OR_GREATER
458471 var cascadingParamAttr = propertyInfo ? . GetCustomAttribute < CascadingParameterAttribute > ( inherit : true ) ;
459472
460473 if ( propertyInfo is null || ( paramAttr is null && cascadingParamAttr is null ) )
461474 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 ) ) ;
462475
463476 return ( propertyInfo . Name , CascadingValueName : cascadingParamAttr ? . Name , IsCascading : cascadingParamAttr is not null ) ;
464- #else
477+ #else
465478 var cascadingParamAttrBase = propertyInfo ? . GetCustomAttribute < CascadingParameterAttributeBase > ( inherit : true ) ;
466479
467480 if ( propertyInfo is null || ( paramAttr is null && cascadingParamAttrBase is null ) )
@@ -494,7 +507,7 @@ static ArgumentException CreateErrorMessageForSupplyFromQuery(
494507 NavigationManager.NavigateTo(uri);
495508 """ ) ;
496509 }
497- #endif
510+ #endif
498511 }
499512
500513 private static bool HasChildContentParameter ( )
0 commit comments