Capture a reference to an component inside a dynamically added wrapper #54918
Unanswered
GeorgeKarlinzer
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I want to render some components inside a wrapper, so when I have the following razor:
<Component/>
I want it to render like this:
I've created a custom
IComponentActivator
that does the job, but when I'm trying to get a reference of a component I get aInvalidCastException
. For exampleThis works:
<ComponentIWantToBeInWrapper />
This doesn't
As I understand reference capture tries to get an instance of the
ComponentIWantToBeInWrapper
type, but instead gets aWrapper
instance and then throws an error.I wonder is there a way to make it work? Is it possible to somehow capture a child component of a wrapper instead of wrapper itself?
Minimal reproduction example:
ComponentActivator.cs
DivWrapper.razor
Dummy.cs
Page.razor
Beta Was this translation helpful? Give feedback.
All reactions