Exposing public properties in designer for custom News maste

Posted by Community Admin on 04-Aug-2018 14:32

Exposing public properties in designer for custom News master control?

All Replies

Posted by Community Admin on 12-May-2014 00:00

I've created a control that extends MasterListView for news content. Is it possible to expose public properties in this control through the designer view?

 Here is my control: http://i.imgur.com/BWW6hu1.png

I was hoping to see these properties show up in this designer UI, but I don't see them: http://i.imgur.com/hthsPLe.png

 Is it possible to expose these properties? Thanks.

 

UPDATE: Just to add details, I've followed the path of this post (www.sitefinity.com/.../extending-newsview) and mine is configured the same way. In my class that extends MasterListView, I have the two public properties that I wish to expose on the "advanced" section of the news widget designer. Right now, they don't display and am not sure why. I know the new view is being used, but the properties just aren't showing up. Thanks.

Posted by Community Admin on 21-May-2014 00:00

Hi Ryan,

Our colleague, Junior, has suggested a solution in the support ticket you have opened about how you can expose public properties in the News widget designer.

In order to achieve this, you need to create a class that inherits from ContentViewMasterDefinition and define your public properties in this class. The class may look like below:

public class CustomMasterViewDefinition : ContentViewMasterDefinition
   
       /// <summary>
       /// Initializes a new instance of the <see cref="MyNewsDefinition"/> class.
       /// </summary>
       public CustomMasterViewDefinition()
           : base(null)
       
       
  
       /// <summary>
       /// Initializes a new instance of the <see cref="MyNewsDefinition"/> class.
       /// </summary>
       /// <param name="configDefinition">The config definition.</param>
       public CustomMasterViewDefinition(ConfigElement configDefinition)
           : base(configDefinition)
       
       
  
       /// <summary>
       /// Gets or sets the test property
       /// </summary>
       [PropertyPersistence]
       public string TestProp get; set;
   

After that you need to create a class that inherits from ContentViewMasterElement and override the GetDefinition() method where you need to return your custom definitions. Here is a sample code:

public class MyContentViewMasterElement : ContentViewMasterElement
 
  
     public MyContentViewMasterElement(ConfigElement element)
         : base(element)
     
     
  
     public override Telerik.Sitefinity.Web.UI.DefinitionBase GetDefinition()
     
         return new CustomMasterViewDefinition(this);
     
 

Then, please build your project. The next step will be to go to Administration -> Settings -> Advanced -> System -> Type implementations mapping -> Telerik.Sitefinity.Web.UI.ContentUI.Config.ContentViewDefinitionElement -> Implementations and add a new implementation. According to the sample above, the implementation might be of type MyContentViewMasterElement.

The last thing you need to do is to recreate the NewsFrontendList and make it to use your custom implementation. In order to do this, please go to Administration -> Settings -> Advanced -> News -> ...
Then please copy all the settings and delete the NewsFrontendList. After that click the

Regards,
Stefani Tacheva
Telerik
 
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
 

Posted by Community Admin on 22-May-2014 00:00

Hello,

In order to recreate the NewsFrontendList with your custom definitions, please go to Administration -> Settings -> Advanced -> News -> Controls -> NewsFrontend -> Views and click on NewsFrontendList and copy the settings. Another option is to open the page in another tab in order to be able to copy the settings when creating your own NewsFrontendList.

Then please delete the NewsFrontendList and recreate it by clicking on the Create new button. Please select it to be of type MyContentViewMasterElement. Copy the settings from the old NewsFrontendList and save the changes.

After performing this, you can drag the News widget on a page and open the widget in advanced mode by clicking on its Edit button and then click the Advanced button at the bottom of the window. Then click ControlDefinition -> Views -> NewsFrontendList and scroll down to see your custom property.

Here is also a video (http://screencast.com/t/ueMV5qlB) for your convenience demonstrating the above steps.


Regards,
Stefani Tacheva
Telerik
 
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
 

This thread is closed