The values entered in the DataForm can be submitted to the underlying data object on three different occasions, using the
CommitMode property of the DataForm.
The next sections list all DataForm members related to commit data feature.
The selected mode is applied through
Telerik.Maui.Controls.DataFormCommitMode) property of the DataForm control. You could choose between three commit modes:
Explicit—The changes are committed explicitly by invoking the
CommitCommandor calling the
CommitChangesmethod of the DataForm.
LostFocus—The changes are committed after the editor loses focus.
PropertyChanged—The changes in the editor are committed immediately on each property change (when the property value changes).
CommitMode can be applied globally to the RadDataForm
<telerik:RadDataForm x:Name="dataForm" CommitMode="LostFocus"/>
or to each editor.
<telerik:RadDataForm x:Name="dataForm" AutoGenerateItems="False"> <telerik:DataFormTextEntry PropertyName="FirstName" HeaderText="Name" CommitMode="LostFocus"/> <telerik:DataFormNumericEditor PropertyName="People" HeaderText="People" Minimum="1" CommitMode="PropertyChanged"/> </telerik:RadDataForm>
CommitChanges— Commits all pending changes in the RadDataForm to the underlying business object. This method is mostly useful when the
CommitModeis set to `
Explicit. The method returns
trueif the validation passes, otherwise
CancelChnages—Cancels all pending changes in the RadDataForm and reverts to the original values from the underlying business object. This method is mostly useful when the
CommitModeproperty is set
ICommand)—Gets a command to a command to commit all pending changes in the RadDataForm. This command is mostly useful when the DataForm
CommitModeproperty is set to
All commit methods call validation first. If the property value passes validation, then the corresponding validation finished event is raised and the value is committed successfully.