How to check whether DataFormItem is IsReadOnly from editor touch event in Xamarin.Android SfDataForm?
You can get the details of any DataFormItem property from the editor events using the Parent property of loaded View Xamarin.Android DataForm.
// Register the editor for data form item.
dataForm.RegisterEditor("Text", new DataFormTextEditorExt(dataForm));
You can wire the events of loaded view in the OnWireEvents override method of inbuilt or custom editor class. By using the Parent property of loaded view in sender object of wired events, you can get the IsReadOnly property of DataFormItem.
public class DataFormTextEditorExt : DataFormTextEditor
{
public DataFormTextEditorExt(SfDataForm dataForm) : base(dataForm)
{
}
protected override void OnWireEvents(EditText view)
{
view.Touch += OnTouch;
base.OnWireEvents(view);
}
private void OnTouch(object sender, View.TouchEventArgs e)
{
var isReadOnly = ((sender as EditText).Parent as DataFormItemView).DataFormItem.IsReadOnly;
}
protected override void OnUnWireEvents(EditText view)
{
view.Touch -= OnTouch;
base.OnUnWireEvents(view);
}
}
Sample Demo: Check_IsReadOnly_DataFormItem
Conclusion
I hope you enjoyed learning about how to check whether DataFormItem isReadOnly from editor touch event in Xamarin.Android SfDataForm.
You can refer to our Xamarin.Android DataForm feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications.
For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.
If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!