Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[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
  Prerequisites
 [Expand]What's Installed
 [Expand]Common Concepts
 [Expand]MVVM Framework
 [Collapse]Controls and Libraries
  [Expand]Windows and Utility Controls
   Dialogs, Notifications and Panels
   Reporting
  [Expand]Data Grid
  [Expand]Ribbon, Bars and Menu
  [Expand]Charts Suite
  [Expand]Pivot Grid
  [Collapse]Scheduler
   [Expand]Getting Started
   [Expand]Appointments
    Resources
    Reminders
   [Expand]Views
   [Expand]Visual Elements
   [Expand]Styles and Templates
   [Expand]Design-Time Features
    Time Zones
   [Collapse]Data Binding
     Mappings
     Mapping Converters
     Custom Fields
    Grouping
    Selecting
    Navigating
    Printing
    End-User Restrictions
   [Expand]Examples
    Migration Guidelines
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Tree List
  [Expand]Gauge Controls
  [Expand]Map Control
  [Expand]Layout Management
  [Expand]Windows Modern UI
  [Expand]Printing-Exporting
  [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
 [Expand]Localization
  Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[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?​​​​​​​