Skip to content

Commit db185f1

Browse files
authored
[Combobox] Fix presetting option (#4255)
* Fix #4250 * Refactor condition to check Value only Remove some test code
1 parent a15a059 commit db185f1

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Core/Components/List/ListComponentBase.razor.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -483,14 +483,18 @@ protected virtual bool GetOptionSelected(TOption item)
483483
{
484484
return OptionSelected.Invoke(item);
485485
}
486-
else if (SelectedOption == null)
486+
else if (SelectedOption == null && string.IsNullOrEmpty(Value))
487487
{
488488
return false;
489489
}
490490
else if (OptionValue != null && SelectedOption != null)
491491
{
492492
return GetOptionValue(item) == GetOptionValue(SelectedOption);
493493
}
494+
else if (!string.IsNullOrEmpty(Value))
495+
{
496+
return string.Equals(GetOptionValue(item), Value, StringComparison.Ordinal);
497+
}
494498
else
495499
{
496500
return Equals(item, SelectedOption);

0 commit comments

Comments
 (0)