diff --git a/BlazorAppTest/Pages/InputsTest.razor b/BlazorAppTest/Pages/InputsTest.razor index 85bfcb670..070f6ae24 100644 --- a/BlazorAppTest/Pages/InputsTest.razor +++ b/BlazorAppTest/Pages/InputsTest.razor @@ -90,7 +90,7 @@ @bind-Value="@model.CultureInfoMultiSelectNames" /> - + Submit diff --git a/Havit.Blazor.Components.Web.Bootstrap/Forms/HxCheckbox.cs b/Havit.Blazor.Components.Web.Bootstrap/Forms/HxCheckbox.cs index 59c52e999..e58338abc 100644 --- a/Havit.Blazor.Components.Web.Bootstrap/Forms/HxCheckbox.cs +++ b/Havit.Blazor.Components.Web.Bootstrap/Forms/HxCheckbox.cs @@ -131,6 +131,16 @@ protected override void RenderChipLabel(RenderTreeBuilder builder) protected override void RenderChipValue(RenderTreeBuilder builder) { - builder.AddContent(0, CurrentValue ? Localizer["ChipValueTrue"] : Localizer["ChipValueFalse"]); + // #886 [HxCheckbox] [HxSwitch] Use Text instead of Yes/No for chips + // If both Text and Label are set, use Text for the positive chip value. + // BTW: Negative value is currently never used as chip is rendered only if the value is not equal to default(TValue). + // This might need additional attention if we implement support for three-state checkboxes + // or allow setting neutral value other than default(TValue). + string positiveValue = Localizer["ChipValueTrue"]; + if (!String.IsNullOrWhiteSpace(Text) && !String.IsNullOrWhiteSpace(Label)) + { + positiveValue = Text; + } + builder.AddContent(0, CurrentValue ? positiveValue : Localizer["ChipValueFalse"]); } }