1
0
mirror of https://github.com/chylex/Minecraft-Phantom-Panel.git synced 2024-10-17 12:42:51 +02:00
Minecraft-Phantom-Panel/Web/Phantom.Web.Components/Utils/EditContextExtensions.cs

14 lines
431 B
C#

using Microsoft.AspNetCore.Components.Forms;
namespace Phantom.Web.Components.Utils;
public static class EditContextExtensions {
public static void RevalidateWhenFieldChanges(this EditContext editContext, string tracked, string revalidated) {
editContext.OnFieldChanged += (_, args) => {
if (args.FieldIdentifier.FieldName == tracked) {
editContext.NotifyFieldChanged(editContext.Field(revalidated));
}
};
}
}