BoldSignA modern eSignature application with affordable pricing. Sign up today for unlimited document usage!
how can i exlude readonly properties of a DataObject from the form
example property:
public double Sum {get => 1+1;}
Hi Andreas,
#Regarding ReadOnly property of the dataform editors
we have documented ‘How to set the readonly property for dataform editor in MAUI DataForm’ in our user guidance document. Please refer to the following UG documentation for your reference.
UG: https://help.syncfusion.com/maui/dataform/editing?cs-save-lang=1&cs-lang=csharp#using-attribute
https://help.syncfusion.com/maui/dataform/editing?cs-save-lang=1&cs-lang=csharp#using-event
Please let us know if you have any concerns.
Regards,
SaiGanesh Sakthivel
yes but i want to have a way to completely remove them from the dataform.
or in a more general way, a way to specify that only some properties are visible in the dataform.
since the DataObject comes from a libary i can not / want not to add Attributes to the class.
so maybe a way like if i use the OnGenerateDataFormItem event to hide/remove selected properties from the DataForm
Andreas,
Your requirement can be achieved with the help of the GenerateDataFormItem event. Inside the event, we can check if the property of the model property is CanWrite or not and change the corresponding dataform editor's IsReadOnly or IsVisible property. Please refer to the code snippet for your reference.
Code Snippet
private void dataForm_GenerateDataFormItem(object sender, GenerateDataFormItemEventArgs e) { if (e.DataFormItem != null) { var canWrite = dataForm.DataObject.GetType().GetProperty(e.DataFormItem.FieldName).CanWrite; if (!canWrite) { //// - set the IsReadOnly property to true e.DataFormItem.IsReadOnly = true; //// - set the IsVisible property to false e.DataFormItem.IsVisible = false; } } } |
Please refer to the demo sample in the attachment. Please
let us know if you have any concerns.