The requested page is not available for the requested platform. You are viewing the content for Default platform.

Provide Custom Names to the Field List Items

  • 3 min to read

This example demonstrates how to change the names of items listed in the Field List (both in the Visual Studio Report Designer and End-User Report Designer for WinForms) by making the report's data source (a DataSet object in this example) implement the IDisplayNameProvider interface.

When a localized field name contains the white space character, leave this white space when referring to this field (e.g. Categories.Categories Products.Discontinued).

When the IDisplayNameProvider.GetFieldDisplayName method returns null or Empty, the corresponding data item becomes hidden in the Field List.

The following image illustrates the look of a Field List before (left picture) and after (right picture) its customization:


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DevExpress.Data;
// ...
class MyDataSet :nwindDataSet, IDisplayNameProvider {
// ...
    string IDisplayNameProvider.GetDataSourceDisplayName() {
        // Substitute the default datasource display name
        // with a custom one.
        return "Northwind Traders";

    string IDisplayNameProvider.GetFieldDisplayName(string[] fieldAccessors) {
        // Get a field name form the data member's name. 
        string fieldName = fieldAccessors[fieldAccessors.Length - 1];

        // Hide the data member if its name ends with 'ID'.
        if(fieldName.EndsWith("ID")) {
            return null;

        // Hide the 'Products' table, because its fields are accessible 
        // via the 'CategoriesProducts' table only.
        if(fieldAccessors[0].StartsWith("Products")) {
            return null;

        // Insert spaces between separate words of a field name.
        return ChangeNames(fieldName);
    public string ChangeNames(string name) {
        string result = string.Empty;
        bool isPrevLow = false;

        foreach(char symb in name) {
            // Check if a character is of upper case.
            // To avoid spaces inside abbreviations, 
            // check if the previous character is of upper case, too.
            if(Char.IsUpper(symb) && isPrevLow) {
                result += " " + symb;
            else {
                result += symb;
            isPrevLow = Char.IsLower(symb);
        return result;
// ...
See Also