Hi Bob,
Thank you for contacting Syncfusion support.
Based on the shared information, we have analyzed reported issue “DataForm crashes with custom DataFormItemManager class and RefreshLayout”. SetValue method ofDataFormItemManager class will be called twice in DataForm while validation andcommit value and since you are calling RefreshLayout inside SetValue method, Validation and Commit will trigger so SetValue called repeatedly. To overcome this DataForm RefreshLayout can be called only when needed, in your requirement call RefreshLayout only when DisplayMedicalPicker and DisplayNotes values are changed.
Code Snippet:
public override void SetValue(DataFormItem dataFormItem, object value)
{
if (dataFormItem.Name == "ServiceType")
{
DisplayMedicalPickerOldvalue = _vm.DisplayMedicalPicker;
_vm.DisplayMedicalPicker = false;
_vm.DisplayNote = false;
if ((string)value == "Medical Expense")
{
_vm.DisplayNote = true;
_vm.DisplayMedicalPicker = true;
}
base.SetValue(dataFormItem, value);
if (DisplayMedicalPickerOldvalue != _vm.DisplayMedicalPicker)
sfDataForm.RefreshLayout(true);
}
else
{
base.SetValue(dataFormItem, value);
}
} |
We have modified your sample for the same,
We hope this helps. Please let us know, if you would require any further assistance.
Regards,
Subburaj Pandian V