(Suggestion) Blazor: RenderFragment target String #39506
Labels
api-suggestion
Early API idea and discussion, it is NOT ready for implementation
area-blazor
Includes: Blazor, Razor Components
enhancement
This issue represents an ask for new feature or an enhancement to an existing one
feature-rendering
Features dealing with how blazor renders components
✔️ Resolution: Answered
Resolved because the question asked by the original author has been answered.
question
Status: Resolved
Hello,
I would like to return a
RendeFragment
as a string, I understand this is not currently possible but I would like to suggest the idea for future consideration.This issue is the same as #22266 and #9493
Use case
In my case I am creating a wrapper component around a WebComponent I have, in my WebComponent I have a
itemTemplate
function that returns aPromise<string>
:Inside the
OnAfterRenderAsync
method, I then call the JavaScript function to set the itemTemplate:Finally in the Blazor component I return the RenderFragment as a string: ( I have found a hacky workaround)
Possible solution
The fragment renders to a
RenderTreeBuilder
, would it be be possible to abstract the TreeBuilder into an interface?What are your thoughts on this?
The text was updated successfully, but these errors were encountered: