Sample: All properties widget designer

Overview

This sample widget demonstrates how all types of properties are displayed in the widget designers. The properties are defined in the Entity class
For more information, see Autogenerated field types.

Extensibility

The sample also demonstrates how to add a field that is dynamically populated with choice options from an external data source.
This is done in the following way:
  1. Declare a custom Attribute and decorate the properties of your Entity class
  2. Declare a custom IPropertyConfigurator that fetches the values from the external data source and passes them along to the metadata of the property.
  3. Register your IPropertyConfigurator with the DI framework as demonstarted in the Program.cs class, using:
    builder.Services.AddSingleton<IPropertyConfigurator, ExternalChoicePropertyConfigurator>();

PREREQUISITES: You must set up a Sitefinity renderer application and connect it to your Sitefinity CMS application. For more information, see Install Sitefinity in ASP.NET Core mode.

NOTE: The instructions in this sample use Visual Studio 2022 and a Sitefinity renderer project named Renderer.

Folder structure

Under your Renderer project, you must create the following folders:

  • Extensibility
  • Entities/AllProperties
  • ViewComponents
  • Views/Shared/Components/AllProperties

Create the widget

  • In the context menu of folder Entities/AllProperties, click Add » Class…
  • In Name, enter AllPropertiesEntity.cs and click Add.
  • In the class, paste the following code and save your changes:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using Progress.Sitefinity.Renderer.Entities.Content;
using Progress.Sitefinity.AspNetCore.ViewComponents.AttributeConfigurator.Attributes;
using Progress.Sitefinity.Renderer.Designers;
using Progress.Sitefinity.Renderer.Designers.Attributes;
using Progress.Sitefinity.Renderer.Models;
using Progress.Sitefinity.Renderer.Entities;
using Progress.Sitefinity.AspNetCore;
using Progress.Sitefinity.AspNetCore.Models;
using Progress.Sitefinity.AspNetCore.ViewComponents;
using Renderer.Extensibility;
namespace Renderer.Entities.AllProperties
{
public class AllPropertiesEntity
{
/// <summary>
/// Gets or sets a property that is not browsable.
/// </summary>
[ReadOnly(true)]
public string Readonly { get; set; }
/// <summary>
/// Gets or sets a property that is not browsable.
/// </summary>
[Browsable(false)]
public string NotBrowsable { get; set; }
/// <summary>
/// Gets or sets a value indicating whether a boolean property is true or false.
/// </summary>
[Category(PropertyCategory.Advanced)]
[Url(ErrorMessage = "Enter valid URL.")]
[DisplayName("URL field")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1056:URI-like properties should not be strings", Justification = "Entity")]
public string UrlField { get; set; }
/// <summary>
/// Gets or sets a value in the email property.
/// </summary>
[EmailAddress(ErrorMessage = "Enter valid email.")]
[DisplayName("Email field")]
public string EmailField { get; set; }
[Placeholder("This is the placeholder")]
public string PlaceHolderProp { get; set; }
[DisplayName("Plain description")]
[Category(PropertyCategory.Advanced)]
[ContentSection("Main")]
[Description("This is the description")]
public string DescriptionProp { get; set; }
[DisplayName("Description")]
[DescriptionExtended("This is the extended description", InlineDescription = "Inline description", InstructionalNotes = "Instructional notes")]
public string DescriptionExtendedProp { get; set; }
[Copy(Exclude = true)]
public int ExcludedFromCopyProp { get; set; }
/// <summary>
/// Gets or sets a value in the double field property.
/// </summary>
[Range(1, 20, ErrorMessage = "Value should be between {1} and {2}.")]
public double DoubleValidation { get; set; }
[DataType(customDataType: KnownFieldTypes.Html)]
[Placeholder("This is the placeholder")]
[ContentContainer]
public string HtmlField { get; set; }
[DataType(customDataType: KnownFieldTypes.TextArea)]
[DefaultValue("This is some text.")]
public string TextAreaField { get; set; }
[DataType(customDataType: KnownFieldTypes.Password)]
public string Password { get; set; }
[ColorPalette("Company")]
public string ColorField { get; set; }
[ColorPalette("Default")]
public string ColorFieldDefaultPalette { get; set; }
[DataType(customDataType: KnownFieldTypes.Range)]
[Suffix("MB")]
public NumericRange Range { get; set; }
[DataType(customDataType: KnownFieldTypes.FileTypes)]
[DisplayName("File types")]
public FileTypes FileTypes { get; set; }
#region views
/// <summary>
/// Gets or sets the view name.
/// </summary>
[ViewSelector]
public string ViewName { get; set; }
[DefaultValue("Second")]
[ViewSelector("AllProperties")]
public string ViewNameDefaultValue { get; set; }
[DefaultValue("invalid")]
[ViewSelector]
public string ViewNameDefaultValueInvalid { get; set; }
#endregion
#region links
[DynamicLinksContainer]
public ComplexObjectWithLinks ObjectWithLinks { get; set; }
[DynamicLinksContainer]
public IList<ComplexObjectWithLinks> ArrayOfObjectWithLinks { get; set; }
public LinkModel Link { get; set; }
[Required]
public LinkModel LinkRequired { get; set; }
[DataType(customDataType: "linkSelector")]
public LinkModel LinkModel { get; set; }
[DataType(customDataType: "linkSelector")]
public LinkModel[] LinkModelMultiple { get; set; }
#endregion
#region strings
[DisplaySettings(Hide = true)]
public string HiddenField { get; set; }
/// <summary>
/// Gets or sets a field that should not be visible.
/// </summary>
[DisplaySettings(HideContent = true)]
public string HiddenContent { get; set; }
/// <summary>
/// Gets or sets a value in the detail css class property.
/// </summary>
[StringLength(6, ErrorMessage = "Value should be between {1} and {2} symbols.", MinimumLength = 2)]
[DisplayName("String length validation")]
public string StringLengthValidation { get; set; }
/// <summary>
/// Gets or sets a value in the test message property.
/// </summary>
[MinLength(2, ErrorMessage = "The message length must be at least {1} symbols.")]
[MaxLength(10, ErrorMessage = "The message must be less than {1} symbols.")]
public string StringValidation { get; set; }
/// <summary>
/// Gets or sets a value in the detail css class property.
/// </summary>
[Required(ErrorMessage = "This is required string {link}.")]
public string StringFieldRequired { get; set; }
/// <summary>
/// Gets or sets the string default value.
/// </summary>
[DefaultValue("custom")]
[ContentSection(FirstBasicSection, 0)]
public string DefaultValueString { get; set; }
/// <summary>
/// Gets or sets the string default value.
/// </summary>
[DefaultValue("custom")]
[FallbackToDefaultValueWhenEmpty]
[ContentSection(FirstBasicSection, 1)]
public string DefaultValueStringWithFallback { get; set; }
[ContentSection(FirstBasicSection, 0)]
public string PlainString { get; set; }
[Mirror(nameof(AllPropertiesEntity.PlainString))]
[ContentSection(SecondBasicSection, 2)]
public string MirroredField { get; set; }
#endregion
#region dates
/// <summary>
/// Gets or sets a value in the date property.
/// </summary>
[Required(ErrorMessage = "This is required date.")]
public DateTime DateFieldRequired { get; set; }
[DefaultValue("2020-09-11T06:38:11.170Z")]
[ContentSection(SecondBasicSection, 3)]
public DateTime? NullableDateWithDefault { get; set; }
/// <summary>
/// Default value is specified as ISO8601 format
/// </summary>
[DefaultValue("2020-09-11T06:38:11.170Z")]
public DateTime DefaultValueDateTimeFromString { get; set; }
/// <summary>
/// Default value is specified as ISO8601 format
/// </summary>
[DefaultValue(typeof(DateTime), "2020-09-11T06:38:11.170Z")]
public DateTime DefaultValueDateTimeFromDate { get; set; }
/// <summary>
/// Default value is specified as ISO8601 format
/// </summary>
[DefaultValue("2020-13-09T06:38:11.170Z")]
public DateTime DefaultValueDateTimeInvalid { get; set; }
[DateSettings(ShowTime = false)]
public DateTime DateFieldWithoutTime { get; set; }
#endregion
#region int
/// <summary>
/// Gets or sets a value in the int property.
/// </summary>
[Required(ErrorMessage = "This is required int.")]
public int IntFieldRequired { get; set; }
/// <summary>
/// Gets or sets a value in the integer field property.
/// </summary>
[Range(1, 20, ErrorMessage = "Value should be between {1} and {2}.")]
public int IntegerValidation { get; set; }
/// <summary>
/// Gets or sets the int default value.
/// </summary>
[DefaultValue(42)]
public int IntDefaultValue { get; set; }
public int PlainInt { get; set; }
public int? NullableInt { get; set; }
[DefaultValue(42)]
public int? NullableIntWithDefault { get; set; }
#endregion
#region bool
/// <summary>
/// Gets or sets a value in the int property.
/// </summary>
[Required(ErrorMessage = "This is required bool.")]
public bool BoolFieldRequired { get; set; }
[ConditionalVisibility("{\"conditions\":[{\"fieldName\":\"BoolFieldRequired\",\"operator\":\"Equals\",\"value\":\"true\"}]}")]
public bool ConditionalProp { get; set; }
/// <summary>
/// Gets or sets the bool default value.
/// </summary>
[DefaultValue(true)]
public bool BoolDefaultValue { get; set; }
public bool PlainBool { get; set; }
public bool? NullableBool { get; set; }
[DefaultValue(true)]
public bool? NullableBoolWithDefault { get; set; }
[Group("Options")]
[DisplayName("Checkbox field")]
[DefaultValue(true)]
[DataType(customDataType: KnownFieldTypes.CheckBox)]
public bool CheckboxField { get; set; }
[Group("Options")]
[DisplayName("Checkbox field")]
[DefaultValue(true)]
[DataType(customDataType: KnownFieldTypes.CheckBox)]
public bool CheckboxField2 { get; set; }
#endregion
#region enums
[DefaultValue(EnumSingle.Value2)]
public EnumSingle EnumDefaultValue { get; set; }
[DefaultValue(EnumSingle.Value2)]
public EnumSingle? NullableEnumDefaultValue { get; set; }
[DefaultValue("Vaal")]
public EnumSingle EnumDefaultValueInvalid { get; set; }
[DefaultValue("Vall")]
public EnumMultiple EnumDefaultValueMultipleInvalid { get; set; }
[DefaultValue(EnumMultiple.Value1 | EnumMultiple.Value2)]
public EnumMultiple EnumDefaultValueMultiple { get; set; }
[DefaultValue(EnumMultiple.Value1 | EnumMultiple.Value2)]
public EnumMultiple? NullableEnumDefaultValueMultiple { get; set; }
public EnumSingle EnumNoDefaultValue { get; set; }
[DataType(customDataType: KnownFieldTypes.ChipChoice)]
public EnumSingle EnumChipChoice { get; set; }
#endregion
#region complex
public ComplexObject Complex { get; set; }
public ComplexObjectWithContent ComplexWithContent { get; set; }
[TableView("TableTitle")]
public ComplexObject ComplexTable { get; set; }
public MultiLevelComplexObject MultiLevelComplexObject { get; set; }
[TableView("BigTableTitle")]
public BigComplexObject BigComplexTable { get; set; }
#endregion
#region collections
[System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "CA2227:Collection properties should be read only", Justification = "Entity")]
public IDictionary<string, ComplexObject> DictionaryWithInitializer { get; set; } = new Dictionary<string, ComplexObject>();
[System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "CA2227:Collection properties should be read only", Justification = "Entity")]
public IDictionary<string, ComplexObject> Dictionary { get; set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "CA2227:Collection properties should be read only", Justification = "Entity")]
public IDictionary<ComplexObject, ComplexObject> DictionaryComplexKey { get; set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "CA2227:Collection properties should be read only", Justification = "Entity")]
public IList<string> List { get; set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "CA2227:Collection properties should be read only", Justification = "Entity")]
public IEnumerable<bool> ListBool { get; set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "CA2227:Collection properties should be read only", Justification = "Entity")]
public IList<ComplexObject> ListComplexObject { get; set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "CA2227:Collection properties should be read only", Justification = "Entity")]
[TableView(Reorderable = true, Selectable = true, MultipleSelect = true)]
public IList<ComplexObject> ListTableView { get; set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "CA2227:Collection properties should be read only", Justification = "Entity")]
public IList<ComplexObjectNoDefaults> ListComplexObjectNoDefaults { get; set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "CA2227:Collection properties should be read only", Justification = "Entity")]
public IList<MultiLevelComplexObject> ListMultiLevelComplexObject { get; set; }
#endregion
#region selectors
[Content(Type = KnownContentTypes.Images, AllowMultipleItemsSelection = true)]
public MixedContentContext Images { get; set; }
[Content(Type = KnownContentTypes.Pages)]
public MixedContentContext Pages { get; set; }
[Content(Type = KnownContentTypes.News)]
public MixedContentContext News { get; set; }
[Content(Type = KnownContentTypes.News, LiveData = true)]
public MixedContentContext NewsLive { get; set; }
[Content(Type = KnownContentTypes.Pages, AllowMultipleItemsSelection = false, DisableInteraction = true, ShowSiteSelector = true)]
public MixedContentContext Page { get; set; }
[Content(Type = "Telerik.Sitefinity.DynamicTypes.Model.Pressreleases.PressRelease")]
public MixedContentContext PressReleases { get; set; }
[Content(Type = KnownContentTypes.Albums)]
public MixedContentContext Albums { get; set; }
[Content(Type = KnownContentTypes.DocumentLibraries, AllowMultipleItemsSelection = false, AllowCreate = false, Provider = "secondlibraries")]
public MixedContentContext DocumentLibrary { get; set; }
[TaxonomyContent(Type = KnownContentTypes.Tags)]
public MixedContentContext Tags { get; set; }
[TaxonomyContent(Type = KnownContentTypes.Categories)]
public MixedContentContext Categories { get; set; }
[TaxonomyContent(Type = "geographical-regions")]
public MixedContentContext CustomTaxonomy { get; set; }
#endregion
[DisplayName("Enum as radio choice field")]
[DataType(customDataType: KnownFieldTypes.RadioChoice)]
public EnumSingle EnumRadioChoice { get; set; }
[DefaultValue(1)]
[DisplayName("Integer as choice field")]
[DataType(customDataType: KnownFieldTypes.ChipChoice)]
[Choice("[{\"Title\":\"1 level\",\"Name\":\"1\",\"Value\":1,\"Icon\":null},{\"Title\":\"2 levels\",\"Name\":\"2\",\"Value\":2,\"Icon\":null},{\"Title\":\"3 levels\",\"Name\":\"3\",\"Value\":3,\"Icon\":null}]")]
public int? IntAsChoice { get; set; }
[DefaultValue(1)]
[DisplayName("Integer as dropdown field")]
[DataType(customDataType: KnownFieldTypes.Choices)]
[Choice("[{\"Title\":\"1 level\",\"Name\":\"1\",\"Value\":1,\"Icon\":null},{\"Title\":\"2 levels\",\"Name\":\"2\",\"Value\":2,\"Icon\":null},{\"Title\":\"3 levels\",\"Name\":\"3\",\"Value\":3,\"Icon\":null}]")]
public int? IntAsDropdownChoice { get; set; }
[ExternalDataChoice]
[DataType(customDataType: KnownFieldTypes.Choices)]
public string DynamicChoiceSingle { get; set; }
[ExternalDataChoice]
[DataType(customDataType: KnownFieldTypes.ChoiceMultiple)]
public string DynamicChoiceMultiple { get; set; }
[Content]
public MixedContentContext AllTypesSelector { get; set; }
[Category(PropertyCategory.Advanced)]
[ContentSection(FirstAdvancedSection, 3)]
public string AFirstAdvancedProp { get; set; }
[Category(PropertyCategory.Advanced)]
[ContentSection(FirstAdvancedSection, 0)]
public string BFirstAdvancedProp { get; set; }
[Category(PropertyCategory.Advanced)]
[ContentSection(SecondAdvancedSection, 0)]
public string ASecondAdvancedProp { get; set; }
[Category(PropertyCategory.Advanced)]
[ContentSection(SecondAdvancedSection, 2)]
public string BSecondAdvancedProp { get; set; }
/// <summary>
/// Gets or sets the attributes for the content list.
/// </summary>
[Category(PropertyCategory.Advanced)]
[ContentSection(Constants.ContentSectionTitles.Attributes, 2)]
[DisplayName("Attributes for...")]
[DataType(customDataType: KnownFieldTypes.Attributes)]
[LengthDependsOn(null, "", "", ExtraRecords = "[{\"Name\": \"AllPropertiesWidget\", \"Title\": \"AllPropertiesWidget\"}]")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "CA2227:Collection properties should be read only", Justification = "Must be able to set in property editor.")]
public IDictionary<string, IList<AttributeModel>> Attributes { get; set; }
private const string FirstBasicSection = "First basic section";
private const string SecondBasicSection = "Second basic section";
private const string FirstAdvancedSection = "First advanced section";
private const string SecondAdvancedSection = "Second advanced section";
}
public class ComplexObjectWithLinks
{
public LinkModel Link { get; set; }
}
public class ComplexObject
{
[DisplayName("String prop")]
[DefaultValue("test")]
public string ChildString { get; set; }
[DisplayName("Int prop")]
[DefaultValue(42)]
public int ChildInt { get; set; }
}
public class ComplexObjectNoDefaults
{
[DisplayName("Boolean prop")]
public bool? BoolProp { get; set; }
[DisplayName("Int prop")]
public int? ChildInt { get; set; }
}
public class BigComplexObject
{
[DisplayName("String prop1")]
[DefaultValue("test1")]
public string ChildString1 { get; set; }
[DisplayName("String prop2")]
[DefaultValue("test2")]
public string ChildString2 { get; set; }
[DisplayName("String prop3")]
[DefaultValue("test3")]
public string ChildString3 { get; set; }
[DisplayName("String prop4")]
[DefaultValue("test4")]
public string ChildString4 { get; set; }
[DisplayName("String prop5")]
[DefaultValue("test5")]
public string ChildString5 { get; set; }
[DisplayName("String prop6")]
[DefaultValue("test6")]
public string ChildString6 { get; set; }
}
public class MultiLevelComplexObject
{
[DisplayName("String prop")]
[DefaultValue("testouter")]
public string ChildString { get; set; }
[DisplayName("Child complex prop")]
public ComplexObject ChildComplexObject { get; set; }
}
public class ComplexObjectWithContent
{
[Content(Type = KnownContentTypes.Events)]
public MixedContentContext Events { get; set; }
}
public enum EnumSingle
{
Value1,
Value2,
Value3
}
[Flags]
public enum EnumMultiple
{
Value1 = 0x01,
Value2 = 0x02,
Value3 = 0x04,
[Browsable(false)]
Value4 = 0x08,
}
}

  • In the context menu of folder ViewComponents, click Add » Class…
  • In Name, enter AllPropertiesViewComponent.cs and click Add.
  • In the class, paste the following code and save your changes:

using System;
using Microsoft.AspNetCore.Mvc;
using Renderer.Entities.AllProperties;
using Progress.Sitefinity.AspNetCore.ViewComponents;
using Newtonsoft.Json.Linq;
namespace Renderer.ViewComponents
{
/// <summary>
/// Test widget with all property variations.
/// </summary>
[SitefinityWidget]
public class AllPropertiesViewComponent : ViewComponent
{
/// <summary>
/// Invokes the view.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public IViewComponentResult Invoke(IViewComponentContext<AllPropertiesEntity> context)
{
if (context == null)
{
throw new ArgumentNullException(nameof(context));
}
var serializedProperties = JObject.FromObject(context.Entity).ToString();
return this.View("Default", serializedProperties);
}
}
}

  • In the context menu of folder Views/Shared/Components/AllProperties, click Add » Class…
  • Select Code File.
  • In Name, enter Default.cshtml and click Add.
  • In the class, paste the following code and save your changes:

@using Renderer.Entities.AllProperties;
@using Progress.Sitefinity.AspNetCore.Mvc.Rendering;
@model string
@* serialized properties as json *@
<!--ModelStart-->
@Html.HtmlSanitize(Html.Raw(this.Model).ToString())
<!--ModelEnd-->
view raw Default.cshtml hosted with ❤ by GitHub

Implement the extensibility

  • In the context menu of folder Extensibility, click Add » Class…
  • In Name, enter ExternalDataChoiceAttribute.cs and click Add.
  • In the class, paste the following code and save your changes:

using Progress.Sitefinity.Renderer.Designers.Attributes;
using System;
using System.ComponentModel;
using System.Runtime.Serialization;
namespace Renderer.Extensibility
{
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false)]
[DataContract(Name = "Choice")]
public class ExternalDataChoiceAttribute : ChoiceAttribute
{
public ExternalDataChoiceAttribute()
: base(null)
{
}
}
}

  • In the context menu of folder Extensibility, click Add » Class…
  • In Name, enter ExternalChoicePropertyConfigurator.cs and click Add.
  • In the class, paste the following code and save your changes:

using System;
using System.ComponentModel;
using Newtonsoft.Json;
using Progress.Sitefinity.Renderer.Designers;
using Progress.Sitefinity.Renderer.Designers.Dto;
namespace Renderer.Extensibility
{
public class ExternalChoicePropertyConfigurator : IPropertyConfigurator
{
public virtual void ProcessPropertyMetadataContainer(PropertyDescriptor descriptor, PropertyMetadataContainerDto propertyContainer, string componentName)
{
foreach (Attribute attr in descriptor.Attributes)
{
ProcessConfigurationExternalDataChoiceAttribute(attr, propertyContainer);
}
}
private static void ProcessConfigurationExternalDataChoiceAttribute(Attribute attribute, PropertyMetadataContainerDto propertyContainer)
{
var externalChoiceAttr = attribute as ExternalDataChoiceAttribute;
if (externalChoiceAttr != null)
{
var choices = FetchChoices();
var serializedChoices = JsonConvert.SerializeObject(choices);
propertyContainer.Properties.Add($"{WidgetMetadataConstants.Prefix}_Choices", serializedChoices);
if (string.Equals(propertyContainer.Type, KnownFieldTypes.ChoiceMultiple))
{
propertyContainer.Properties.Add($"{WidgetMetadataConstants.Prefix}_Choices_AllowMultiple", bool.TrueString);
}
var choiceKey = $"{WidgetMetadataConstants.Prefix}_Choice_Choices";
if (propertyContainer.Properties.ContainsKey($"{WidgetMetadataConstants.Prefix}_Choice_Choices"))
{
propertyContainer.Properties[choiceKey] = serializedChoices;
}
else
{
propertyContainer.Properties.Add(choiceKey, serializedChoices);
}
}
}
private static ChoiceValueDto[] FetchChoices()
{
var dynamicChoices = new ChoiceValueDto[]
{
new ChoiceValueDto("Option 1", "Option 1"),
new ChoiceValueDto("Option 2", "Option 2"),
new ChoiceValueDto("Option 3", "Option 3")
};
return dynamicChoices;
}
}
}

Register the custom IPropertyConfigurator

You must register the ExternalChoicePropertyConfigurator class in the Program.cs.

The Program.cs file should look in the following way:

using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;
using Progress.Sitefinity.AspNetCore;
using Progress.Sitefinity.AspNetCore.FormWidgets;
using Progress.Sitefinity.Renderer.Designers;
using all_properties.Extensibility;
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddSitefinity();
builder.Services.AddViewComponentModels();
builder.Services.AddFormViewComponentModels();
builder.Services.AddSingleton<IPropertyConfigurator, ExternalChoicePropertyConfigurator>();
var app = builder.Build();
if (!app.Environment.IsDevelopment())
{
app.UseExceptionHandler("/Error");
app.UseHsts();
}
app.UseStaticFiles();
app.UseRouting();
app.UseSitefinity();
app.Run();
view raw Program.cs hosted with ❤ by GitHub

Build your solution.

Result

When you open your Renderer application and open the New editor, you will see the AllProperties widget in the widget selector. When you add the widget on your page and edit it, you can see a list of all types of fields, which you can configure.

AllProperties

Run the sample

This sample is available in Sitefinity’s GitHub repository. You can run and play with it.
To do this, perform the following:

  1. Go to Sitefinity’s GitHub repository Sitefinity ASP.NET Core samples.
  2. Expand Code and click Download ZIP.
  3. Extract the files on your computer.
  4. In the extracted folder, navigate to sitefinity-aspnetcore-mvc-samples-master/src/all-properties folder.
  5. Open the all-properties.sln in Visual Studio.
  6. Open the appsettings.json file.
  7. In section “Sitefinity”, change the “Url” property to the URL of your Sitefinity CMS site.
    If you have deployed Sitefinity CMS on the IIS, point to “https://localhost:<https_port>".
  8. In Visual Studio, in the context menu of all-properties project, click View in Browser.
  9. Log in to your Sitefinity CMS instance and place the widget on a page.

Want to learn more?

Increase your Sitefinity skills by signing up for our free trainings. Get Sitefinity-certified at Progress Education Community to boost your credentials.

Get started with Integration Hub | Sitefinity Cloud | Sitefinity SaaS

This free lesson teaches administrators, marketers, and other business professionals how to use the Integration hub service to create automated workflows between Sitefinity and other business systems.

Web Security for Sitefinity Administrators

This free lesson teaches administrators the basics about protecting yor Sitefinity instance and its sites from external threats. Configure HTTPS, SSL, allow lists for trusted sites, and cookie security, among others.

Foundations of Sitefinity ASP.NET Core Development

The free on-demand video course teaches developers how to use Sitefinity .NET Core and leverage its decoupled architecture and new way of coding against the platform.

Was this article helpful?

Next article

Sample: Mega menu