Solution Review: Applying Dynamic Rendering

Review the solution of applying dynamic rendering in Blazor.

We'll cover the following

To solve this challenge, we populated lines 32–34 in the OnDropdownChange method of the Index.razor class. In this method, we extract the name of the Razor file from the event arguments. This is what we set as the Title entry in the parameters dictionary. We also prepend the fully qualified namespace to this name, which is Blazor.Pages, and pass it into the Type.GetType method to extract the Razor component data type based on this name. We set this type as the value of the selectedType field.

Solution

The code widget below shows the complete solution to the exercise.

Get hands-on with 1400+ tech skills courses.