Reset MudForm field IsModified attribute #8839
Unanswered
RDUser-dev
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, I created a component similar to winform's
PropertyGrid
.Basically I used a
MudForm
filled with templates auto-generated by reflection containing the appropriate MudField for each given property.Using the
IsModified
property of theEditContext
I am able to report which properties have been modified by the user.I'm trying unsuccessfully to clear the
IsModified
flag when the user resets the property to its initial value.I'll try to explain myself with an example that imitates the functioning of my component, simplifying everything that is not related to the problem: https://try.mudblazor.com/snippet/QEGyYyxEyfphVnjU
If I modify the numeric field the
IsModified
flag is set and by pressing the button it is reset correctly, and so the MarkAsUnmodified works correctly.However, if I try to do the same thing via the ValueChanged event of the MudNumericField, the IsModified flag remains set.
I believe the problem is due to the fact that the MudField internally calls the NotifyFieldChanged of the editcontext after I have marked the form field as unmodified.
Having to maintain the
For
attribute to allow validation, is there a way to prevent this from happening?Beta Was this translation helpful? Give feedback.
All reactions