So i'd like to use a custom renderer for a LinkItemCollection property. So I can enable the on page editing highlighting and support for a custom rendered link collection. Problem is, I cannot use the existing linkcollection renderer that PropertyFor uses out of the box, because my list is much more customized with html. I thought I saw somewhere a tutorial (but can't find it now) as to the way to define a custom renderers for a specific property (not just ALL linkcollections, but for a specific one on a template) in episerver 7. I'd like to accomplish this by using an MVC partial view (if possible). I'm just unsure of the correct way to use UIHint and have it use the template i define. I tried placing a partial view in
and registering an attribute like
and tried even removing the presentationlayer overload. Much like the original MVC concept works when you use DisplayFor, etc. but with no luck.
Any thoughts on how to accomplish this?
This should help you on the way.
Thanks for the link. I had seen this article previously. My issue is that it does not lay out how to specify a custom rendering for a specific property on a template (i.e. - customizing the rendering of a link collection for a specific link collection on a specific template), rather it shows you how to override rendering for a whole property type across the cms.
something like this: http://world.episerver.com/Blogs/Linus-Ekstrom/Dates/2012/10/Custom-renderers-for-properties/
But using a view instead of the user control?
Does UIHint work for you in this case? You can set an UI hint on the property for the view model (or content type if youre not using view model), and then create a partial view named as the UIHint (for example "myChangedStuff") with the model set to the type youre value type. Hope this can work for you.
Have you found a solution to this yet? I have the exact same problem, when trying to have a separate DisplayTempalte for a contentarea. If I add a PresentationLayer.Website I get the original UI-Edit control (not the legacy control) which I was after, but then my specific DisplayTemplate stops to work.
Although it all works when I rename my DisplayTemplate to override the standard ContentArea and remove the UIHINT, but then every ContentArea will be run through my control and that is not optimal.
This seems to be a problem indeed. If you set a UIHint and create a corresponding display template, everything seems to work - but for content areas you get a nonfunctional legacy editor. :/
If you do as suggested above and add the presentation layer parameter (setting it to PresentationLayer.Website) it seems the UI hint isn't recognized anymore and the default EPiServer display template is used.
Also, creating a new display template called "ContentArea" may work, but it seems you sometimes get the native display template and sometimes get your own, depending on the inner workings of the MVC initialization. There is already a display template called "ContentArea" in EPiServer, and it seems these collide sometimes. :(