@if (prev != null) { @prev.Title @if (prev.SubTitle != null) { @prev.SubTitle } } @if (next != null) { @next.Title @if (next.SubTitle != null) { @next.SubTitle } }
@code { [CascadingParameter] public MainLayout MainLayout { get; set; } DemoMenuItem prev; DemoMenuItem next; protected override void OnInitialized() { base.OnInitialized(); MainLayout.PrevNextNav = this; } public void SetPrevNextNav(DemoMenuItem prev, DemoMenuItem next) { this.prev = prev; this.next = next; StateHasChanged(); } }