Views is usually written in the form of a Razor markup page with a .razor
file extension.
Components in
Blazor are formally referred to as Razor components, informally as Blazor components. Razor is a syntax
for combining HTML markup with C# code designed for developer productivity.
Theme base view is Pages/_Master.cshtml
, in this file we are connecting global mandatory css and js files. Each layouts and pages should be wrapped with this view.
Content will be rendered in the place of @RenderBody()
.
Layout partials are located in Shared/Layout/Partials
, folder contains all partials used by layout. You can access these partials from Layout.Partials
namespace
@using Layout.Partials.SidebarLayout
<_Header></_Header>
Global theme partials are located inside Shared/Partials
folder.
@using Starterkit.Shared.Partials.Drawers
<_ActivityDrawer></_ActivityDrawer>
Add your new page views inside Pages/
folder. Page view layout can be specified with
@layout
directive and a route with @page
directive.
@page "/counter"
@layout Layout._Blank;
<!--page content-->
Available theme layout could be found inside Shared/Layout
folder. Theme
default
Layout is set inside Starterkit/App.razor
.
To apply Layout for all page views in folder you can add _Imports.razor
and inside this file
specify
your layout
with @layout
directive.