I've made a custom FormItem and I need access to the EditContext. This works, but - is there a simpler way to get access to the EditContext?
The Form:
<TelerikForm
Model="@AWonderfullModel"
OnSubmit="@OnSubmitHandler"
@ref="@FormRef">
<FormItems >
<CascadingValue Name="TheForm" Value="@FormRef">
@foreach (var row in RexFormItems)
{
<DynamicComponent Type="@row.Component" Parameters="@row.Parameter"/>
}
</CascadingValue>
</FormItems>
....
</TelerikForm>
I populate the FormRef via the CascadingValue
and in my CustomControl simple:
[CascadingParameter]
public TelerikForm TheForm { get; set; }
....
protected override void OnParametersSet()
{
Model = TheForm.EditContext.Model;
...
}
This works well, but we discussed this and there was the Idea, that the Form or the EditContext is reachable in an other way.