From 69db85acbfb528d497cb6b33945ed1a2b95f20fd Mon Sep 17 00:00:00 2001 From: noctwolf Date: Sun, 18 Aug 2019 15:26:04 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9B=E6=90=9C=E7=B4=A2=E4=BD=93?= =?UTF-8?q?=E9=AA=8C=EF=BC=8C=E9=9D=9E=E8=8B=B1=E6=96=87=E7=8E=AF=E5=A2=83?= =?UTF-8?q?=E6=90=9C=E7=B4=A2=E6=8E=A7=E4=BB=B6=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../UserControl/Main/LeftMainContent.xaml | 4 ++-- .../UserControl/Main/LeftMainContent.xaml.cs | 19 +++++-------------- 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Main/LeftMainContent.xaml b/src/Shared/HandyControlDemo_Shared/UserControl/Main/LeftMainContent.xaml index 92ecd073..62b91a65 100644 --- a/src/Shared/HandyControlDemo_Shared/UserControl/Main/LeftMainContent.xaml +++ b/src/Shared/HandyControlDemo_Shared/UserControl/Main/LeftMainContent.xaml @@ -26,7 +26,7 @@ - + @@ -185,7 +185,7 @@ - + diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Main/LeftMainContent.xaml.cs b/src/Shared/HandyControlDemo_Shared/UserControl/Main/LeftMainContent.xaml.cs index f7a69289..b401825d 100644 --- a/src/Shared/HandyControlDemo_Shared/UserControl/Main/LeftMainContent.xaml.cs +++ b/src/Shared/HandyControlDemo_Shared/UserControl/Main/LeftMainContent.xaml.cs @@ -63,23 +63,14 @@ namespace HandyControlDemo.UserControl } } - private void SearchBarStyle_OnSearchStarted(object sender, FunctionEventArgs e) + private void SearchBar_OnSearchStarted(object sender, FunctionEventArgs e) { if (e.Info == null) return; - - foreach (var listBoxItem in ListBoxStyle.Items.OfType()) + if (!(sender is FrameworkElement searchBar && searchBar.Tag is ListBox listBox)) return; + foreach (var listBoxItem in listBox.Items.OfType()) { - listBoxItem.Show(listBoxItem.Content.ToString().ToLower().Contains(e.Info.ToLower())); - } - } - - private void SearchBarControl_OnSearchStarted(object sender, FunctionEventArgs e) - { - if (e.Info == null) return; - - foreach (var listBoxItem in ListBoxControl.Items.OfType()) - { - 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())); } } }