Class SfDataForm
DataForm control provides UI for editing all the public properties
of data object with appropriate editors based on type of property.
DataForm control provides options to control editing, validation of data
and customization of layout.
Inheritance
Namespace: Syncfusion.Android.DataForm
Assembly: Syncfusion.SfDataForm.Android.dll
Syntax
public class SfDataForm : FrameLayout
Constructors
SfDataForm(Context)
Initializes a new instance of the SfDataForm.
Declaration
public SfDataForm(Context context)
Parameters
Type | Name | Description |
---|---|---|
Android.Content.Context | context | Context of the view |
SfDataForm(Context, IAttributeSet)
Initializes a new instance of the SfDataForm.
Declaration
public SfDataForm(Context context, IAttributeSet attributeSet)
Parameters
Type | Name | Description |
---|---|---|
Android.Content.Context | context | Context of the view |
Android.Util.IAttributeSet | attributeSet | Required attributes set |
SfDataForm(Context, IAttributeSet, Int32)
Initializes a new instance of the SfDataForm.
Declaration
public SfDataForm(Context context, IAttributeSet attributeSet, int definedStyle)
Parameters
Type | Name | Description |
---|---|---|
Android.Content.Context | context | Context of the view |
Android.Util.IAttributeSet | attributeSet | Required attributes set |
System.Int32 | definedStyle | Default style attribute. |
SfDataForm(Context, IAttributeSet, Int32, Int32)
Initializes a new instance of the SfDataForm.
Declaration
public SfDataForm(Context context, IAttributeSet attributeSet, int definedStyle, int defaultStyleResource)
Parameters
Type | Name | Description |
---|---|---|
Android.Content.Context | context | |
Android.Util.IAttributeSet | attributeSet | |
System.Int32 | definedStyle | |
System.Int32 | defaultStyleResource |
SfDataForm(IntPtr, JniHandleOwnership)
Initializes a new instance of the SfDataForm.
Declaration
protected SfDataForm(IntPtr javaReference, JniHandleOwnership transfer)
Parameters
Type | Name | Description |
---|---|---|
System.IntPtr | javaReference | Java Native Interface object reference. |
Android.Runtime.JniHandleOwnership | transfer | A Android.Runtime.JniHandleOwnership indicating how to handle. |
Properties
ColumnCount
Gets or sets the value denotes the number of editor to be arranged per row. Be default one editor for one property arranged with label.
Declaration
public int ColumnCount { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | The default value is one. |
CommitMode
Gets or sets the value that determines, when the value entered by user should be saved to the data object.
Declaration
public CommitMode CommitMode { get; set; }
Property Value
Type | Description |
---|---|
CommitMode | The default value is LostFocus. |
DataObject
Gets or sets a data object to view or edit the properties. DataForm generates the editors and labels from the public properties of data object.
Declaration
public object DataObject { get; set; }
Property Value
Type | Description |
---|---|
System.Object | The default value is null. |
EditorWidth
Gets or sets the editor width.
Declaration
public int EditorWidth { get; set; }
Property Value
Type |
---|
System.Int32 |
IsReadOnly
Gets or sets a value that indicates whether editors enabled for editing.
Declaration
public bool IsReadOnly { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | The default value is false. |
Remarks
IsReadOnly takes higher priority when explicit defined. Editors can be enabled or disabled for particular property by setting IsReadOnly in AutoGeneratingDataFormItem. Editors can be enabled or disabled for particular property by setting System.ComponentModel.DataAnnotations.EditableAttribute.AllowEdit.
ItemManager
Gets the reference to the DataFormItemManager instance which generates DataFormItem with default settings based on attribute setting.
Declaration
public DataFormItemManager ItemManager { get; set; }
Property Value
Type |
---|
DataFormItemManager |
LabelPosition
Gets or sets the value denotes how to layout the label associated with editor. Label's can be positioned either at the top or left side of editor.
Declaration
public LabelPosition LabelPosition { get; set; }
Property Value
Type | Description |
---|---|
LabelPosition | The default value is Left. |
LabelWidth
Gets or sets the label width.
Declaration
public int LabelWidth { get; set; }
Property Value
Type |
---|
System.Int32 |
LayoutManager
Gets or sets the reference to the DataFormLayoutManager instance which layouts labels and editors in DataFormItemView.
Declaration
public DataFormLayoutManager LayoutManager { get; set; }
Property Value
Type |
---|
DataFormLayoutManager |
SourceProvider
Gets or sets the reference to the SourceProvider instance which is used to get the source for picker type editors.
Declaration
public SourceProvider SourceProvider { get; set; }
Property Value
Type |
---|
SourceProvider |
ValidationMode
Gets or sets a value that denotes when the user input should be validated based on IDataErrorInfo and System.ComponentModel.DataAnnotations.ValidationAttribute.
Declaration
public ValidationMode ValidationMode { get; set; }
Property Value
Type | Description |
---|---|
ValidationMode | One of the ValidationMode enum. The default value is LostFocus. |
Remarks
The SfDataForm process the built-in validations when data object implements IDataErrorInfo or property defined with System.ComponentModel.DataAnnotations.ValidationAttribute. The validation can be performed explicitly by handling Validating property of SfDataForm.
Methods
CollapseGroup(String)
Collapse group by group name.
Declaration
public void CollapseGroup(string groupName)
Parameters
Type | Name | Description |
---|---|---|
System.String | groupName | The name of the group. |
Commit()
Commits all property values in data form items.
Declaration
public void Commit()
Commit(String)
Commits the value of the specific property.
Declaration
public void Commit(string propertyName)
Parameters
Type | Name | Description |
---|---|---|
System.String | propertyName |
Dispose(Boolean)
Disposes all the resources used by the SfDataForm class.
Declaration
protected override void Dispose(bool isDisposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | isDisposing | Indicates whether the call is from Dispose method or from a finalizer. |
ExpandGroup(String)
Expands group by group name.
Declaration
public void ExpandGroup(string groupName)
Parameters
Type | Name | Description |
---|---|---|
System.String | groupName | The name of the group. |
GetGroupCollapseIcon()
Gets the Resource ID from the Android resources for the group collapse icon.
Declaration
public virtual Bitmap GetGroupCollapseIcon()
Returns
Type | Description |
---|---|
Android.Graphics.Bitmap | The group collapse icon. |
GetGroupExpanderIcon()
Gets the Resource ID from the Android resources for group expander icon.
Declaration
public virtual Bitmap GetGroupExpanderIcon()
Returns
Type | Description |
---|---|
Android.Graphics.Bitmap | The group expander icon. |
OnAttachedToWindow()
Initializes the DataForm's item manager.
Declaration
protected override void OnAttachedToWindow()
OnLayout(Boolean, Int32, Int32, Int32, Int32)
Called from layout when this view should assign a size and position to each of its children.
Declaration
protected override void OnLayout(bool changed, int left, int top, int right, int bottom)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | changed | This is a new size or position for this view |
System.Int32 | left | Left position, relative to parent |
System.Int32 | top | Top position, relative to parent |
System.Int32 | right | Right position, relative to parent |
System.Int32 | bottom | Bottom position, relative to parent |
OnMeasure(Int32, Int32)
Positions and sizes the children in the Syncfusion.Android.DataForm.
Declaration
protected override void OnMeasure(int widthMeasureSpec, int heightMeasureSpec)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | widthMeasureSpec | Width measure spec. |
System.Int32 | heightMeasureSpec | Height measure spec. |
RefreshLayout(Boolean)
Loads more fields when the user wants to generate the fields that was canceled.
Declaration
public void RefreshLayout(bool generateAllItems = false)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | generateAllItems | True to regenerate all the items from the committed data object. false only generate the field that was canceled initially. |
RegisterEditor(String, DataFormEditorBase)
Register custom editor with editor name.
Declaration
public void RegisterEditor(string editorName, DataFormEditorBase dataFormEditor)
Parameters
Type | Name | Description |
---|---|---|
System.String | editorName | The editorName to use the CustomEditor for the property. |
DataFormEditorBase | dataFormEditor | The custom dataFormEditor to load the customized editor for property. |
RegisterEditor(String, String)
Registers editor for property name.
Declaration
public void RegisterEditor(string propertyName, string editor)
Parameters
Type | Name | Description |
---|---|---|
System.String | propertyName | The propertyName to have editor. |
System.String | editor | The editor that loaded for property name. |
RegisterEditor(Type, String)
Registers editor for property type.
Declaration
public void RegisterEditor(Type type, string editor)
Parameters
Type | Name | Description |
---|---|---|
System.Type | type | The type to have editor. |
System.String | editor | The editor that loaded for type. |
ScrollTo(String)
Scrolls to specific editor in data form.
Declaration
public void ScrollTo(string propertyName)
Parameters
Type | Name | Description |
---|---|---|
System.String | propertyName |
UpdateEditor(String)
Updates the value of the specific property in corresponding editor.
Declaration
public void UpdateEditor(string propertyName)
Parameters
Type | Name | Description |
---|---|---|
System.String | propertyName | The property to be updated. |
Validate()
Validates all property values of data form items.
Declaration
public bool Validate()
Returns
Type |
---|
System.Boolean |
Validate(String)
Validates the value of the specific property.
Declaration
public bool Validate(string propertyName)
Parameters
Type | Name | Description |
---|---|---|
System.String | propertyName | The property to be validated. |
Returns
Type |
---|
System.Boolean |
Events
AutoGeneratingDataFormItem
Occurs for each DataFormItem or DataFormGroupItem generated for the public properties of data object.
Declaration
public event EventHandler<AutoGeneratingDataFormItemEventArgs> AutoGeneratingDataFormItem
Event Type
Type |
---|
System.EventHandler<AutoGeneratingDataFormItemEventArgs> |
Remarks
You can cancel the event for particular property to stop it from showing in display. Also you can customize the settings using DataFormItem or DataFormGroupItem.
GroupItemCollapsed
Occurs when group gets collapsed by user.
Declaration
public event EventHandler<GroupItemCollapsedEventArgs> GroupItemCollapsed
Event Type
Type |
---|
System.EventHandler<GroupItemCollapsedEventArgs> |
GroupItemCollapsing
Occurs when user try collapse a group. You can cancel the user action using this event.
Declaration
public event EventHandler<GroupItemCollapsingEventArgs> GroupItemCollapsing
Event Type
Type |
---|
System.EventHandler<GroupItemCollapsingEventArgs> |
Remarks
You can cancel the user action by using GroupItemCollapsingEventArgs.
GroupItemExpanded
Occurs when group expanded by user.
Declaration
public event EventHandler<GroupItemExpandedEventArgs> GroupItemExpanded
Event Type
Type |
---|
System.EventHandler<GroupItemExpandedEventArgs> |
GroupItemExpanding
Occurs when user try expand a group. You can cancel the user action using this event.
Declaration
public event EventHandler<GroupItemExpandingEventArgs> GroupItemExpanding
Event Type
Type |
---|
System.EventHandler<GroupItemExpandingEventArgs> |
Remarks
You can cancel the user action by using GroupItemExpandingEventArgs.
Validated
Occurs after completion of user input validation.
Declaration
public event EventHandler<ValidatedEventArgs> Validated
Event Type
Type |
---|
System.EventHandler<ValidatedEventArgs> |
Validating
Occurs when SfDataForm validates the user input.
Declaration
public event EventHandler<ValidatingEventArgs> Validating
Event Type
Type |
---|
System.EventHandler<ValidatingEventArgs> |
ValidationCompleted
Occurs when Explicit to get the invalid DataFormItems details.
Declaration
public event EventHandler<ValidationCompletedEventArgs> ValidationCompleted
Event Type
Type |
---|
System.EventHandler<ValidationCompletedEventArgs> |