Convert IRenderedFragment to IElement #796
Unanswered
mycarrysun
asked this question in
Q&A
Replies: 1 comment 20 replies
-
Hey @mycarrysun hope you are doing good, an If you have a component called <h3 class="header text-center">MyTitle</h3>
<button @onclick="DoesSomething">Press me if you can</button>
<AnotherBlazorComponent></AnotherBlazorComponent> Now it depends a bit what you really want to achieve. You can get the h3 element like that: IRenderFragment<MyComponent> cut = RenderComponent<MyComponent>();
var h3 = cut.Find("h3"); // also Find("h3") would work
var classes = h3.ComputeCurrentStyle(); // This contains all the classes associated with the h3 element So it boils down what element you exactly want. Cheers |
Beta Was this translation helpful? Give feedback.
20 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'd like to be able to go from an
IRenderedFragment
to anIElement
because of theComputeCurrentStyle
method that exists only onIElement
.Any ideas?
Beta Was this translation helpful? Give feedback.
All reactions