I'm trying to create a hack to make the RadzenTabs validation aware,
I've created a custom RadzenRequiredValidator that have as a parameter the RadzenTabsItem that it is in, when a validation fails, i want to change the tabs to that tab.
ParentTabItem.Tabs.SelectedIndex = ParentTabItem.Index;
but it dose not seams to work , so as a work around i have a call back event that is change the selectTabIndex which is bind to the RadzenTabs SelectedIndex, this hack works, but is there a way to change the tab directly using the RadzenTabsItem
Herer is my custom validator
@inherits RadzenRequiredValidator
@code {
[Parameter]
public RadzenTabsItem? ParentTabItem { get; set; }
[Parameter]
public EventCallback<int> HaveValidation { get; set; }
protected override bool Validate(IRadzenFormComponent component)
{
var ok = base.Validate(component);
if (ParentTabItem is not null)
{
if (!ok)
{
ParentTabItem.Tabs.SelectedIndex = ParentTabItem.Index;
// HaveValidation.InvokeAsync(ParentTabItem.Index);
}
ParentTabItem.Icon = !ok ? "priority_high" : string.Empty;
ParentTabItem.IconColor = !ok ? "#EA3323" : string.Empty;
}
return ok;
}
}
thanks