Exposing public properties in designer for custom News master control?
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.
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
);
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.