Locations module: Create the designer view
After you create the Locations module: Create the locations details view, you create the locations view designer. Perform the following:
- In Visual Studio, open the context menu of folder Web » UI » Public » Designers and click Add » Class…
- In the Name input field, enter LocationsViewDesigner.
- Open the file and add the following namespaces:
using Telerik.Sitefinity.Web.UI.ControlDesign;
using Telerik.Sitefinity.Configuration;
using Telerik.Sitefinity.Web.Configuration;
- Change the class definition to:
public class LocationsViewDesigner : ContentViewDesignerBase
{
}
- Specify the name of the script descriptor:
protected override string ScriptDescriptorTypeName
{
get
{
return typeof(ContentViewDesignerBase).FullName;
}
}
- Define the resource assembly info:
protected override System.Type ResourcesAssemblyInfo
{
get
{
return Config.Get<ControlsConfig>().ResourcesAssemblyInfo;
}
}
- Override the AddViews method the following way:
protected override void AddViews(Dictionary<string, ControlDesignerView> views)
{
var listSettings = new ListSettingsDesignerView();
listSettings.DesignedMasterViewType = typeof(MasterListView).FullName;
var singleItemSettings = new SingleItemSettingsDesignerView();
singleItemSettings.DesignedDetailViewType = typeof(DetailsView).FullName;
views.Add(listSettings.ViewName, listSettings);
views.Add(singleItemSettings.ViewName, singleItemSettings);
}
- Save the file.
In the code above, you first get the name of the JavaScript type that the designer will use. The designers can reuse, for example, the base class implementation and just customize some labels. Next, you get a type from the resource assembly. Resource assembly is an assembly that contains embedded resources such as templates, images, CSS files, and so on. By default, the assembly is Telerik.Sitefinity.Resources.dll. Finally, you add the designer views.