Type Properties
- 3 minutes to read
In XAF, properties of the System.Type type can be displayed in a combo box editor that lists the available object types in ASP.NET Core Blazor and WinForms applications.
Examples
ASP.NET Core Blazor

TypePropertyEditor
Used for Type properties by default.
When you declare a Type property displayed with the help of TypePropertyEditor, apply the System.ComponentModel.TypeConverter attribute to it. In the attribute, pass the type of the converter that returns a collection of values representing data types in the Property Editor. For example, pass a built-in LocalizedClassInfoTypeConverter. It returns values of the Caption property of the corresponding BOModel | <Class> nodes.
If you do not use the TypeConverter attribute for a type property, XAF loads a string representation of found types to the editor’s Items collection.
VisibleInReportsTypePropertyEditor
The editor is inherited from TypePropertyEditor. Used by the Reports V2 Module. It lists the types of business classes that have the VisibleInReports property of the Application Model‘s IModelClass node set to true.
WinForms

Each Windows Forms Property Editor is available in two forms:
- A standalone control (displays property value in a Detail View)
- A repository item (displays property value in a List Editor that supports in-place editing)
TypePropertyEditor
Control: ImageComboBoxEdit editor from the XtraEditors Library.
Repository Item: RepositoryItemImageComboBox item from the XtraEditors Library.
Description:
Used for Type properties by default.
When you declare a Type property displayed with the help of TypePropertyEditor, apply the System.ComponentModel.TypeConverter attribute to it. In the attribute, pass the type of the converter that returns a collection of values representing data types in the Property Editor. For example, pass a built-in LocalizedClassInfoTypeConverter. It returns values of the Caption property of the corresponding BOModel | <Class> nodes.
If you do not use the TypeConverter attribute for a type property, XAF loads a string representation of found types to the editor’s Items collection.
Use Alt + Down Arrow to expand the TypePropertyEditor‘s drop-down window.
VisibleInReportsTypePropertyEditor
Control: ImageComboBoxEdit editor from the XtraEditors Library.
Repository Item: RepositoryItemImageComboBox item from the XtraEditors Library.
Description:
The editor is inherited from TypePropertyEditor. Used by the Reports V2 Module. It lists the types of business classes that have the VisibleInReports property of the Application Model‘s IModelClass node set to true.
Customize the Types List
Type Property Editors use the LocalizedClassInfoTypeConverter type converter to create the list of values displayed in the editor’s combo box. This converter returns persistent types only. To add all registered non-persistent types to this collection, follow these steps:
Create a custom converter. Inherit
LocalizedClassInfoTypeConverterand set theAllowAddNonPersistentObjectsfield value totrue.using DevExpress.Persistent.Base; // ... public class MyLocalizedClassInfoTypeConverter : LocalizedClassInfoTypeConverter { public MyLocalizedClassInfoTypeConverter() { AllowAddNonPersistentObjects = true; } }Pass the custom converter to the TypeConverter attribute.
using System.ComponentModel; using DevExpress.Xpo; using DevExpress.ExpressApp.Utils; // ... [ValueConverter(typeof(TypeToStringConverter))] [TypeConverter(typeof(LocalizedClassInfoTypeConverter))] [Size(SizeAttribute.Unlimited)] public Type DataType { get { return GetPropertyValue<Type>(nameof(DataType)); } set { SetPropertyValue<Type>(nameof(DataType), value); } }Override the
AddCustomItemsmethod in your custom converter to add specific types to the collection.using DevExpress.Persistent.Base; // ... public class MyLocalizedClassInfoTypeConverter : LocalizedClassInfoTypeConverter { // ... public override void AddCustomItems(List<Type> list) { list.Add(typeof(MyType)); list.Sort(this); base.AddCustomItems(list); } }Override the
GetSourceCollectionmethod to create the entire collection manually.using DevExpress.Persistent.Base; // ... public class MyLocalizedClassInfoTypeConverter : LocalizedClassInfoTypeConverter { // ... public override List<Type> GetSourceCollection(ITypeDescriptorContext context) { List<Type> result = new List<Type>(); // Populate the type list here. return result; } }
Tip
You can see more customization techniques in the How to hide or filter out certain types from the drop-down editor for the System.Type properties KB article.