Possibility to use with custom component #122
Unanswered
devtendenz
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'm new to Blazor and using this FluentValidationValidator, which works great. But I have many MudTextFields with the same properties, like:
<MudTextField Immediate="true" Margin="Margin.Dense" Disabled="SelectedCompany_ReadOnly" @bind-Value="@SelectedMutableCompany.VisitAddress" For="@(() => SelectedMutableCompany.VisitAddress)" Label="@_myLocalizer.GetTranslation("STR_VisitAddress")" Variant="Variant.Text" />
The properties Immediate, Margin, Variant are all the same. So I thought of putting that in a custom component MyTextInput.
But the validation does not work anymore now, what am I doing wrong?
MyTextInput.razor:
`@using System.Linq.Expressions
<MudTextField Immediate="true" Margin="Margin.Dense" Disabled="Disabled" @bind-Value="@BindingValue" For="(() => BindingValue)" Label="@Label" Variant="Variant.Text" />
@code {
[Parameter] public bool Disabled { get; set; }
[Parameter] public string Label { get; set; }
}
`
And the call:
<MyTextInput Disabled="SelectedCompany_ReadOnly" For="@(() => SelectedMutableCompany.VisitAddress)" @bind-BindingValue="@SelectedMutableCompany.VisitAddress" Label="@_myLocalizer.GetTranslation("STR_VisitAddress")"></MyTextInput>
Beta Was this translation helpful? Give feedback.
All reactions