show not found in search box

This commit is contained in:
qhy040404
2024-03-18 20:27:19 +08:00
parent 1d0a72493e
commit d531c81fa2
4 changed files with 10 additions and 1 deletions

View File

@@ -56,7 +56,8 @@ internal sealed partial class AutoSuggestTokenBox : TokenizingTextBox
sender.ItemsSource = AvailableTokens
.Where(kvp => kvp.Value.Value.Contains(Text, StringComparison.OrdinalIgnoreCase))
.OrderBy(kvp => kvp.Value.Kind)
.Select(kvp => kvp.Value);
.Select(kvp => kvp.Value)
.DefaultIfEmpty(SearchToken.NotFound);
}
}

View File

@@ -7,6 +7,8 @@ namespace Snap.Hutao.Control.AutoSuggestBox;
internal sealed class SearchToken
{
public static readonly SearchToken NotFound = new(SearchTokenKind.None, SH.ControlAutoSuggestBoxNotFoundValue);
public SearchToken(SearchTokenKind kind, string value, Uri? iconUri = null, Uri? sideIconUri = null, Color? quality = null)
{
Value = value;

View File

@@ -144,6 +144,9 @@
<data name="ContentDialogSavePrimaryButtonText" xml:space="preserve">
<value>Save</value>
</data>
<data name="ControlAutoSuggestBoxNotFoundValue" xml:space="preserve">
<value>No results found</value>
</data>
<data name="ControlImageCachedImageInvalidResourceUri" xml:space="preserve">
<value>Invalid Uri</value>
</data>

View File

@@ -144,6 +144,9 @@
<data name="ContentDialogSavePrimaryButtonText" xml:space="preserve">
<value>保存</value>
</data>
<data name="ControlAutoSuggestBoxNotFoundValue" xml:space="preserve">
<value>未找到结果</value>
</data>
<data name="ControlImageCachedImageInvalidResourceUri" xml:space="preserve">
<value>无效的 Uri</value>
</data>