改进搜索体验,非英文环境搜索控件名

This commit is contained in:
noctwolf committed 2019-08-18 15:26:04 +08:00
1 parent 14fff8cf16
commit 69db85acbf
2 files changed
+7 -16

No files matched your search

@@ -63,23 +63,14 @@ namespace HandyControlDemo.UserControl
}
}
private void SearchBarStyle_OnSearchStarted(object sender, FunctionEventArgs<string> e)
private void SearchBar_OnSearchStarted(object sender, FunctionEventArgs<string> e)
{
if (e.Info == null) return;
foreach (var listBoxItem in ListBoxStyle.Items.OfType<ListBoxItem>())
if (!(sender is FrameworkElement searchBar && searchBar.Tag is ListBox listBox)) return;
foreach (var listBoxItem in listBox.Items.OfType<ListBoxItem>())
{
listBoxItem.Show(listBoxItem.Content.ToString().ToLower().Contains(e.Info.ToLower()));
}
}
private void SearchBarControl_OnSearchStarted(object sender, FunctionEventArgs<string> e)
{
if (e.Info == null) return;
foreach (var listBoxItem in ListBoxControl.Items.OfType<ListBoxItem>())
{
listBoxItem.Show(listBoxItem.Content.ToString().ToLower().Contains(e.Info.ToLower()));
listBoxItem.Show(listBoxItem.Content.ToString().ToLower().Contains(e.Info.ToLower()) ||
listBoxItem.Tag.ToString().Replace("DemoCtl", "").ToLower().Contains(e.Info.ToLower()));
}
}
}