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())); } } }