add support for search
This commit is contained in:
1 parent
9b827cba3c
commit
d0094f049e
9 files changed
+415
-314
No files matched your search
@@ -1,5 +1,9 @@
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using HandyControl.Data;
|
||||
using HandyControl.Tools.Extension;
|
||||
|
||||
// ReSharper disable once CheckNamespace
|
||||
namespace HandyControlDemo.UserControl
|
||||
@@ -12,8 +16,6 @@ namespace HandyControlDemo.UserControl
|
||||
public LeftMainContent()
|
||||
{
|
||||
InitializeComponent();
|
||||
listStyle.Items.SortDescriptions.Add(new SortDescription("Content", ListSortDirection.Ascending));
|
||||
listControl.Items.SortDescriptions.Add(new SortDescription("Content", ListSortDirection.Ascending));
|
||||
}
|
||||
|
||||
private void TabControl_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
@@ -29,5 +31,49 @@ namespace HandyControlDemo.UserControl
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonStyleAscending_OnClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (ButtonStyleAscending.IsChecked == true)
|
||||
{
|
||||
listStyle.Items.SortDescriptions.Add(new SortDescription("Content", ListSortDirection.Ascending));
|
||||
}
|
||||
else
|
||||
{
|
||||
listStyle.Items.SortDescriptions.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonControlAscending_OnClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (ButtonControlAscending.IsChecked == true)
|
||||
{
|
||||
listControl.Items.SortDescriptions.Add(new SortDescription("Content", ListSortDirection.Ascending));
|
||||
}
|
||||
else
|
||||
{
|
||||
listControl.Items.SortDescriptions.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
private void SearchBarStyle_OnSearchStarted(object sender, FunctionEventArgs<string> e)
|
||||
{
|
||||
if (e.Info == null) return;
|
||||
|
||||
foreach (var listBoxItem in listStyle.Items.OfType<ListBoxItem>())
|
||||
{
|
||||
listBoxItem.Show(listBoxItem.Content.ToString().Contains(e.Info));
|
||||
}
|
||||
}
|
||||
|
||||
private void SearchBarControl_OnSearchStarted(object sender, FunctionEventArgs<string> e)
|
||||
{
|
||||
if (e.Info == null) return;
|
||||
|
||||
foreach (var listBoxItem in listControl.Items.OfType<ListBoxItem>())
|
||||
{
|
||||
listBoxItem.Show(listBoxItem.Content.ToString().Contains(e.Info));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user