Last Updated: 15 Mar 2023 11:37 by ADMIN
Release 5.1.0
Created on: 30 Sep 2022 08:41
Category: DataForm
Type: Feature Request
Provide a more flexible mechanism for configuring the DataForm

Currently, the DataForm uses a mechanism for automatic editor generation based on the underlying business object, which can be controlled with a boolean flag:

  • When AutoGenerateItems is set to true, the DataForm generates editors automatically for all public properties of the business object. It is possible to customize what is generated by specifying editors for certain properties explicitly in XAML or in code, e.g.:

<telerik:RadDataForm AutoGenerateItems="True">
    <telerik:DataFormRadTextMaskedEditor PropertyName="Phone" Mask="+990 00 000 0000" />

  • When AutoGenerateItems is set to false, the DataForm does not generate any editors by default, so all editors must be populated manually, as illustrated above.

While such mechanism offers some degree of customization, it is not sufficient in many scenarios, forcing the users to configure the DataForm manually in some very common cases:

  • Ignoring certain properties from the business object, that should not be visible or editable. The only currently supported mechanism is to use the NotMappedAttribute, which does not play well with ORMs such as Entity Framework, excluding the property from database schema generation as well.
  • Providing different non-default editors based on custom logic. The current approach requires to specify the editors one by one for each property, which is equivalent to manual configuration. It is not possible to change what type of editor is generated for a given data type for example.

Considering this, it should be beneficial to introduce a mechanism for customizing the generation process programmatically. Ideally, such mechanism should be exposed as an event or another type of callback, invoked for each property of the underlying business object. The custom code should be allowed to specify at least that:

  • The current property should be processed with the default generation mechanism.
  • The current property should use a custom editor, configured programmatically.
  • The current property should be ignored, no editor should be generated.