MVC widget icon (Not sidebar icon)

Posted by sfdev on 11-Jul-2019 16:06

Hi,

I am currently developing custom MVC widget. I would like to know how to add custom icon to the widget after it was dragged into a pocket?

I used a content block as a comparison to my widget which doesn't has its icon.

Please help. Thanks!

All Replies

Posted by natabc23 on 11-Jul-2019 16:11

Hi,

You need to change the MVCTemplateEditorRouteHandler  and MVCPageEditorRouteHandler, use this:

www.crmportalconnector.com/.../adding-widget-icons-to-your-custom-sitefinity-mvc-widgets-with-code

The MVCTemplateEditorRouteHandler is public in Sitefintiy 11.

Posted by sfdev on 11-Jul-2019 16:18

How about the anchor link that can open the widget designer, will it be added after I change the route handler?

Posted by eganeva on 22-Jul-2019 06:46

Hi,

Another approach will be to implement the interface ICustomWidgetVisualizationExtended as we do in the Image widget, Content block widget, etc. Using this interface you will need to set the IsEmpty property and WidgetCssClass. Then the CSS class will be applied only when the IsEmpty condition is met and only while you are in edit of page.

Regards,

Elena

This thread is closed