AndrewK.Umbraco.Dictionary
1.1.0
dotnet add package AndrewK.Umbraco.Dictionary --version 1.1.0
NuGet\Install-Package AndrewK.Umbraco.Dictionary -Version 1.1.0
<PackageReference Include="AndrewK.Umbraco.Dictionary" Version="1.1.0" />
<PackageVersion Include="AndrewK.Umbraco.Dictionary" Version="1.1.0" />
<PackageReference Include="AndrewK.Umbraco.Dictionary" />
paket add AndrewK.Umbraco.Dictionary --version 1.1.0
#r "nuget: AndrewK.Umbraco.Dictionary, 1.1.0"
#:package AndrewK.Umbraco.Dictionary@1.1.0
#addin nuget:?package=AndrewK.Umbraco.Dictionary&version=1.1.0
#tool nuget:?package=AndrewK.Umbraco.Dictionary&version=1.1.0
AndrewK.Umbraco.Dictionary
AndrewK.Umbraco.Dictionary is a custom property editor for Umbraco 16 that allows content editors to store and manage multiple key-value pairs in a structured way.
It provides an intuitive user interface for adding, editing, and removing dictionary-style data directly within the Umbraco backoffice.
Features
- Key-Value Pair Management: Add, edit, and remove key-value pairs with an intuitive UI.
- Configurable Limits: Set minimum and maximum number of entries through property editor configuration.
- Drag & Drop Reordering: Reorder dictionary items using drag handles.
- Validation Support: Built-in validation for required keys and proper form handling.
- Type-Safe Access: Strong-typed property value converter returns
ICollection<KeyValuePair<string, string>>
. - Umbraco 16 Compatible: Built specifically for Umbraco 16 using modern Lit elements and TypeScript.
Installation
You can install the package via NuGet:
dotnet add package AndrewK.Umbraco.Dictionary
Usage
Creating a Dictionary Property
- Create a new Data Type in the Umbraco backoffice
- Select "AndrewK Dictionary" as the property editor
- Configure minimum and maximum number of entries (optional)
- Add the data type to your document type
Configuration Options
- Minimum: Enter the minimum number of key-value pairs to be displayed
- Maximum: Enter the maximum number of key-value pairs to be displayed (enter 0 for unlimited)
Accessing Dictionary Data in Controllers/Services/Templates
public class MyController : Controller
{
public IActionResult Index()
{
var content = // ... get your content
var dictionary = content.Value<ICollection<KeyValuePair<string, string>>>("myDictionaryProperty");
foreach (var kvp in dictionary ?? [])
{
var key = kvp.Key;
var value = kvp.Value;
// Process your key-value pairs
}
return View();
}
}
Example Of Setting Dictionary Data in Controllers/Services
public class MyController : Controller
{
public IActionResult Index()
{
var collectionOfKeyValuePairs = // ... your collection, serializable to a list of key-value pairs
// needed to serialize property names (e.g., 'key' or 'value') in a way the converter can deserialize them
var settings = new JsonSerializerSettings
{
ContractResolver = new CamelCasePropertyNamesContractResolver()
};
// set serialized object
content.SetValue(PropertyAlias, JsonConvert.SerializeObject(collectionOfKeyValuePairs, settings));
return View();
}
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net9.0
- Microsoft.AspNetCore.Components.Web (>= 9.0.0)
- Umbraco.Cms.Core (>= 16.0.0)
NuGet packages (3)
Showing the top 3 NuGet packages that depend on AndrewK.Umbraco.Dictionary:
Package | Downloads |
---|---|
AndrewK.Umbraco.Dropdown
Makes it possible to work with label on UI and values on the server side |
|
AndrewK.Umbraco.RadioButtonList
Makes it possible to work with label on UI and values on the server side |
|
AndrewK.Umbraco.CheckBoxList
Makes it possible to work with label on UI and values on the server side |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version 1.1.0:
- Improved FE value migration from `string` or `array` type properties
- native and custom validation improvements