How to set layout for a Blazor component programmatically?

Viewed 719

In Razor View there is a property named Layout that allows me to set the layout for that view with code, simply just like this

@{
    Layout = "_MyLayout";
}

Now in Blazor component is there something similar that allows me to set the layout for my component programmatically like in razor view? All I see right now is that the layout for a component can be hard coded with a directive at the top of the component like this

@layout MyLayout

It would be very helpful to be able to set it with code.

0 Answers
Related