MainLayoutBase.cs

        public IEnumerable<Store> StoreList { get; set; }
        public Store Store { get; set; }

MainLayout.razor

    <CascadingValue Value="StoreList" Name="StoreList">
        <CascadingValue Value="Store" Name="Store">
            @Body
        </CascadingValue>
    </CascadingValue>

IndexBase.cs

        [CascadingParameter(Name = "StoreList")]
        protected IEnumerable<Store> StoreList { get; set; }
        [CascadingParameter(Name = "Store")]
        public Store Store { get; set; }

Sources:

https://docs.microsoft.com/en-us/aspnet/core/blazor/components/cascading-values-and-parameters?view=aspnetcore-5.0

Last modified: January 2, 2021

Author

Comments

Write a Reply or Comment