Exist model - \Models\HeaderPart.cs. In Driver, want create CategoriesMenuDriver and use HeaderPart:
public class CategoriesMenuDriver : ContentPartDriver<HeaderPart>
{
private readonly dynamic shapeFactory;
private readonly IMenuAccessor menuAccessor;
public CategoriesMenuDriver(
IShapeFactory shapeFactory,
IMenuAccessor menuAccessor)
{
this.shapeFactory = shapeFactory;
this.menuAccessor = menuAccessor;
}
protected override DriverResult Display(HeaderPart part, string displayType, dynamic shapeHelper)
{
return this.ContentShape("Parts_CategoriesMenu", () => shapeHelper.Parts_CategoriesMenu(
MenuItems: this.menuAccessor.GetMenu<NavigationMenuItem>("UserAccount")));
}
}
But in CategoriesMenu view
var headerPart = (HeaderPart)Model.ContentItem.HeaderPart;
Model.ContentItem is null.
Can i get HeaderPart in View CategoriesMenu?