Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@trnktms
Created January 13, 2021 15:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save trnktms/186bc8ac72b7259e572f16b8ee11dc1b to your computer and use it in GitHub Desktop.
Save trnktms/186bc8ac72b7259e572f16b8ee11dc1b to your computer and use it in GitHub Desktop.
public class ChildrenBlock : ViewComponent
{
private readonly IViewModelBinder _viewModelBinder;
public ChildrenBlock(IViewModelBinder viewModelBinder)
{
_viewModelBinder = viewModelBinder;
}
public async Task<IViewComponentResult> InvokeAsync()
{
return View(
"~/Views/Shared/Components/SitecoreComponent/ChildrenBlock.cshtml",
await _viewModelBinder.Bind<ChildrenBlockModel>(this.ViewContext));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment