3

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.

Ray
  • 12,101
  • 27
  • 95
  • 137
  • The direct translation of what a layout is in a Razor view would be a simple parent component that renders the contained ChildContent at a certain location. You wouldn’t do that with a Razor directive but just a custom component. – poke Aug 09 '20 at 23:36

0 Answers0