I am trying to change the way a ContentArea is rendered. I call Html.PropertyFor() with a specific tag, which is registered with IViewTemplateModelRegistrator to render a custom partial view. However, I cannot get this to work (it works with custom blocks, though). If I create /Views/Shared/DisplayTemplates/ContentArea.cshtml, it works. But I don't want to change the default view there, but rather create my own. Has anyone experienced this? :)
Are you willing to override content area display template or the way how blocks would be rendered inside conten area using tag? `Tag` has very special meaning for the content areas and its rendering pipeline. You can take a look at registration process blog post, template selection blog post or extending the content area. Maybe one of those could give you some clue why stuff is not working in your case.
Valdis made a great serie of blog posts on how this works.
Here you can read (down right now it seems, but hopefully works later) about the templeresolver part
Basically what I want to do is to change the default ContentAreaRenderer but only for one specific ContentArea. My logic was to tag the PropertyFor and just to define a custom template for that area. I could alternatively do it manually, but calling Html.RenderMyCustomContentArea(), but I think that using PropertyFor() is the preferable way.
I will check the blogs now :-)
Using `Tag` in `PropertyFor()` will not be effective as `Tag` comes up on the stage later - when template selection process begins for the content area items. Renderer for the content area is singleton.
This worked perfectly for us. Thanks