diff --git a/Excel2Json/Excel2Json/MainWindow.xaml b/Excel2Json/Excel2Json/MainWindow.xaml
index c179630..9b5d17e 100644
--- a/Excel2Json/Excel2Json/MainWindow.xaml
+++ b/Excel2Json/Excel2Json/MainWindow.xaml
@@ -23,6 +23,7 @@
+
@@ -58,7 +59,6 @@
-
diff --git a/Excel2Json/Excel2Json/MainWindow.xaml.cs b/Excel2Json/Excel2Json/MainWindow.xaml.cs
index b7abb06..f6049e4 100644
--- a/Excel2Json/Excel2Json/MainWindow.xaml.cs
+++ b/Excel2Json/Excel2Json/MainWindow.xaml.cs
@@ -17,6 +17,7 @@
using System.Security.Cryptography;
using System.Windows.Documents;
using System.Collections.Generic;
+using System.Windows.Data;
namespace Excel2
{
@@ -167,6 +168,8 @@ private void Grid_Loaded(object sender, RoutedEventArgs e)
mMainGrid = sender as Grid;
ExcelListView.ItemsSource = ListViweItemData;
+ CollectionView view = (CollectionView)CollectionViewSource.GetDefaultView(ExcelListView.ItemsSource);
+ view.Filter = UserFilter;
ExcelPath_TextBox.DataContext = ExcelPath;
JsonPath_TextBox.DataContext = JsonPath;
@@ -359,9 +362,15 @@ private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs
private void TextBox_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e)
{
TextBox tb = sender as TextBox;
- UpdateText(tb, tb.Text);
+ if (tb.Name.Equals("FilterList_TextBox"))
+ {
+ CollectionViewSource.GetDefaultView(ExcelListView.ItemsSource).Refresh();
+ }
+ else
+ UpdateText(tb, tb.Text);
}
+
private void Textbox_DragEnter(object sender, DragEventArgs e)
{
//TextBox tb = sender as TextBox;
@@ -606,6 +615,7 @@ private void ShowFileList()
if (ProgressBar != null)
ProgressBar.Value = 0;
+
}
private void SetColor(string _colorName, string _theme)
@@ -667,5 +677,14 @@ private void UpdateText(TextBox _textBox, string _name)
break;
}
}
+
+ private bool UserFilter(object item)
+ {
+ if (String.IsNullOrEmpty(FilterList_TextBox.Text))
+ return true;
+ else
+ return ((item as ListViewItemData).FileName.IndexOf(FilterList_TextBox.Text, StringComparison.OrdinalIgnoreCase) >= 0);
+ }
+
}
}