Log In
[Expand]Welcome to DevExpress .NET Documentation
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Collapse]WPF Controls
 [Expand]What's Installed
 [Expand]Common Concepts
 [Expand]MVVM Framework
 [Collapse]Controls and Libraries
  [Expand]Windows and Utility Controls
   Dialogs, Notifications and Panels
  [Expand]Data Grid
  [Expand]Ribbon, Bars and Menu
  [Expand]Charts Suite
  [Expand]Pivot Grid
   [Expand]Getting Started
   [Expand]Visual Elements
   [Expand]Styles and Templates
   [Expand]Design-Time Features
    Time Zones
   [Collapse]Data Binding
     Mapping Converters
     Custom Fields
    End-User Restrictions
    Migration Guidelines
  [Expand]Rich Text Editor
  [Expand]Tree List
  [Expand]Gauge Controls
  [Expand]Map Control
  [Expand]Layout Management
  [Expand]Windows Modern UI
  [Expand]Data Editors
  [Expand]Navigation Controls
  [Expand]Spell Checker
  [Expand]Property Grid
  [Expand]PDF Viewer
  [Expand]TreeMap Control
  [Expand]Diagram Control
  [Expand]Scheduler (legacy)
 [Expand]Scaffolding Wizard
  Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Report Server
[Expand]eXpressApp Framework
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Custom Fields

Custom fields allows you to extend the set of properties of a persistent object, such as Appointments, Resources, Labels and Statuses. You can define custom data fields, map them to custom properties of persistent objects and use these user-defined property values within your code.

To create custom field mapping, choose a name that is not in the list of the standard persistent object properties (see the Mappings document). Create a custom field mapping in XAML by declaring a CustomFieldMapping within the mappings and use the selected name to specify the CustomFieldMapping.Name property value. To obtain a custom field value, use the SourceObjectContainer.CustomFields property and access the required field by its name.

To explain custom fields technique in more detail, consider the situation when a resource has an associated picture. We have to display the picture in the resource header, so create a custom field that allows obtaining a picture using the ResourceItem custom property value. The picture is contained in the ResourceImage field of the ResourceItem's source object. The Photo will be the name of a custom property The following code create the required custom mapping:

Show Me

A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=T603619.

To display an image in the resource header, create a custom data template in which use the Resource.CustomFields.Photo path for image data binding. Assign the data template to the ViewBase.ResourceHeaderContentTemplate property.

Is this topic helpful?​​​​​​​