Editors

The RadDataForm provides the following methods to replace the default editors:

  • void RegisterEditor(string propertyName, EditorType editorType): Registers an editor type for a property with a specific name.
  • void RegisterEditor(Type propertyType, EditorType editorType): Registers an editor type for a specific property type.

The editors registered for property name are with higher priority than the ones registered for property type.

Editor Types

The values from the EditorType enumeration are interpreted differently by each platform and when an editor type is missing, the closest type is used. The following table shows the type mapping:

EditorType Android
native editor
iOS
native editor
WinRT/UWP
native editor
value type
SliderEditor AndroidDataFormSeekBarEditor TKDataFormSliderEditor SliderCustomEditor float
PickerEditor DataFormSpinnerEditor TKDataFormPickerViewEditor ListEditor **requires PropertyDataSourceProvider
TextEditor DataFormTextEditor TKDataFormTextFieldEditor StringEditor string
SegmentedEditor DataFormSegmentedEditor TKDataFormSegmentedEditor SegmentedCustomEditor **requires PropertyDataSourceProvider
NumberPickerEditor DataFormNumberPickerEditor TKDataFormStepperEditor NumericEditor double
IntegerEditor DataFormIntegerEditor TKDataFormNumberEditor *StringEditor int
DecimalEditor DataFormDecimalEditor TKDataFormDecimalEditor *StringEditor double
CheckBoxEditor DataFormCheckBoxEditor *TKDataFormSwitchEditor BooleanEditor bool
ToggleButtonEditor DataFormToggleButtonEditor TKDataFormSwitchEditor instead *BooleanEditor bool
DateEditor DataFormDateEditor TKDataFormDatePickerEditor DateEditor DateTime
TimeEditor DataFormTimeEditor TKDataFormTimePickerEditor TimeEditor DateTime
Custom Specifies that custom editor control will be provided.

* Some editors are not supported in all native platforms. In these cases we use the closest substitute.
** PropertyDataSourceProvider

Sometimes your property type will not be the same as the type supported by the editor, e.g. when you wish to edit integers with a NumberPicker editor. In this case you will have to use a converter.

Custom Editors

When a Custom editor type is registered, specific renderer methods will be called on each platform. You will have to inherit from the renderers and override specific methods to setup a custom editor.

dataForm.RegisterEditor("Gender", EditorType.Custom);

[assembly: ExportRenderer(typeof(RadDataForm), typeof(CustomRenderer))]

CustomRenderer : DataFormRenderer
{
    ...
}

The DataFormRenderer works differently on each platform - see the specific methods available for override below.

Android

Android DataFormRenderer available methods for override:

  • GetCustomEditorForProperty
  • GetCustomViewerForProperty
  • UpdateEditor
  • UpdateViewer

On Android if a property is read-only, a viewer is used.

iOS

iOS DataFormRenderer available methods for override:

  • GetCustomEditorType
  • InitEditor
  • UpdateEditor

On iOS if a property is read-only, the editor is disabled.

UWP

UWP DataFormRenderer available methods for override:

  • GetCustomEditorType
  • UpdateEditor

See Also