Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Collapse]eXpressApp Framework
 [Expand]Fundamentals
 [Expand]Getting Started
 [Expand]Concepts
 [Expand]Design-Time Features
 [Expand]Functional Testing
 [Expand]Deployment
 [Collapse]Task-Based Help
  [Expand]Business Model Design
  [Expand]Application Model
  [Expand]Actions
  [Expand]Navigation
  [Expand]Views
  [Expand]List Editors
  [Collapse]Property Editors
    How to: Customize a Built-in Property Editor (ASP.NET)
    How to: Customize a Built-in Property Editor (WinForms)
    How to: Disable and Hide Property Editors Based on a Business Rule
    How to: Display an Integer Property as an Enumeration
    How to: Implement a Property Editor Based on a Custom Control (WinForms)
    How to: Implement a Property Editor based on Custom Controls (ASP.NET)
    How to: Implement a Property Editor Using a DevExpress WinForms Control
    How to: Supply Predefined Values for the String Property Editor Dynamically (ASP.NET)
    How to: Supply Predefined Values for the String Property Editor Dynamically (WinForms)
    How to: Use Criteria Property Editors
  [Expand]Templates
  [Expand]Filtering
  [Expand]Reporting
  [Expand]Dashboards
  [Expand]Scheduler and Notifications
  [Expand]Maps
  [Expand]Security
  [Expand]Workflow
  [Expand]Localization
  [Expand]Testing
  [Expand]Miscellaneous UI Customizations
 [Expand]Frequently Asked Questions
 [Expand]API Reference
[Expand]CodeRush
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

How to: Display an Integer Property as an Enumeration

This topic describes how to display a business class integer property as an enumeration, in case you do not wish to modify (or cannot modify) the source code of this class.

Show Me

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

Consider the following SampleObject business class.

Assume that this class is located in an external assembly, and you cannot modify its code. The task is to display enumeration values instead of integers (e.g., Value1 for zero, Value2 for 1, etc.). Follow the steps below to learn how to solve this task.

  1. Implement an enumeration whose values will be mapped to integer values.

  2. In a WinForms module project, create a custom MyEnumIntPropertyEditor Property Editor by inheriting the EnumIntPropertyEditor<SampleEnum> class. Note that your editor should be public.

  3. Run the Model Editor for the WinForms module project. Set the IModelCommonMemberViewItem.PropertyEditorType property of the BOModel | OwnMembers | IntegerProperty node to MyEnumIntPropertyEditor.
  4. In an ASP.NET module project, create a custom MyEnumIntPropertyEditor Property Editor by inheriting the ASPxEnumIntPropertyEditor<SampleEnum> class. Note that your editor should be public.

  5. Run the Model Editor for the ASP.NET module project. Set the IModelCommonMemberViewItem.PropertyEditorType property of the BOModel | OwnMembers | IntegerProperty node to ASPxMyEnumIntPropertyEditor.

The images below illustrate the results in a WinForms application and an ASP.NET application.

WinForms

ASP.NET

How would you rate this topic?​​​​​​​