diff --git a/src/Core/Components/List/FluentCombobox.razor.cs b/src/Core/Components/List/FluentCombobox.razor.cs index 45b2b61cd6..9c77ae078d 100644 --- a/src/Core/Components/List/FluentCombobox.razor.cs +++ b/src/Core/Components/List/FluentCombobox.razor.cs @@ -167,7 +167,7 @@ protected override async Task ChangeHandlerAsync(ChangeEventArgs e) { if (SelectedOption != null) { - return OptionText.Invoke(SelectedOption) ?? OptionValue.Invoke(SelectedOption) ?? SelectedOption.ToString(); + return OptionText.Invoke(SelectedOption) ?? OptionValue?.Invoke(SelectedOption) ?? SelectedOption.ToString(); } else { diff --git a/src/Core/Components/List/ListComponentBase.razor.cs b/src/Core/Components/List/ListComponentBase.razor.cs index 895876ee46..d35d3a010e 100644 --- a/src/Core/Components/List/ListComponentBase.razor.cs +++ b/src/Core/Components/List/ListComponentBase.razor.cs @@ -115,7 +115,7 @@ protected string? InternalValue /// Only for and components. /// [Parameter] - public virtual Func OptionValue { get; set; } + public virtual Func? OptionValue { get; set; } /// /// Gets or sets the function used to determine if an option is disabled. @@ -220,7 +220,6 @@ protected ListComponentBase() Id = Identifier.NewId(); OptionText = (item) => item?.ToString() ?? null; - OptionValue = (item) => OptionText.Invoke(item) ?? item?.ToString() ?? null; _renderOptions = RenderOptions; }