Browse Source

fix AutoCompleteBox dropdown not opening when the text box is empty

pull/12057/head
AtomCrafty 3 years ago
parent
commit
4b5b6225f1
  1. 11
      src/Avalonia.Controls/AutoCompleteBox/AutoCompleteBox.cs

11
src/Avalonia.Controls/AutoCompleteBox/AutoCompleteBox.cs

@ -1320,17 +1320,14 @@ namespace Avalonia.Controls
// Evaluate the conditions needed for completion.
// 1. Minimum prefix length
// 2. If a delay timer is in use, use it
bool populateReady = newText.Length >= MinimumPrefixLength && MinimumPrefixLength >= 0;
if (populateReady && MinimumPrefixLength == 0 && String.IsNullOrEmpty(newText) && String.IsNullOrEmpty(SearchText))
{
populateReady = false;
}
_userCalledPopulate = populateReady ? userInitiated : false;
bool minimumLengthReached = newText.Length >= MinimumPrefixLength && MinimumPrefixLength >= 0;
_userCalledPopulate = minimumLengthReached && userInitiated;
// Update the interface and values only as necessary
UpdateTextValue(newText, userInitiated);
if (populateReady)
if (minimumLengthReached)
{
_ignoreTextSelectionChange = true;

Loading…
Cancel
Save