diff --git a/ILSpy/Controls/ResourceObjectTable.xaml b/ILSpy/Controls/ResourceObjectTable.xaml
index c98364814..e719f15b1 100644
--- a/ILSpy/Controls/ResourceObjectTable.xaml
+++ b/ILSpy/Controls/ResourceObjectTable.xaml
@@ -27,16 +27,22 @@
+
+
diff --git a/ILSpy/Controls/ResourceObjectTable.xaml.cs b/ILSpy/Controls/ResourceObjectTable.xaml.cs
index 2a836d44a..20f2a2a48 100644
--- a/ILSpy/Controls/ResourceObjectTable.xaml.cs
+++ b/ILSpy/Controls/ResourceObjectTable.xaml.cs
@@ -18,9 +18,12 @@
using System;
using System.Collections;
+using System.Collections.Generic;
+using System.ComponentModel;
using System.Text;
using System.Windows;
using System.Windows.Controls;
+using System.Windows.Data;
using System.Windows.Input;
namespace ICSharpCode.ILSpy.Controls
@@ -30,6 +33,9 @@ namespace ICSharpCode.ILSpy.Controls
///
public partial class ResourceObjectTable : UserControl
{
+ ICollectionView filteredView;
+ string filter;
+
public ResourceObjectTable(IEnumerable resources, FrameworkElement container)
{
InitializeComponent();
@@ -38,7 +44,22 @@ namespace ICSharpCode.ILSpy.Controls
if (!double.IsNaN(container.ActualWidth))
Width = Math.Max(container.ActualWidth - 45, 0);
MaxHeight = container.ActualHeight;
- resourceListView.ItemsSource = resources;
+
+ filteredView = CollectionViewSource.GetDefaultView(resources);
+ filteredView.Filter = OnResourceFilter;
+ resourceListView.ItemsSource = filteredView;
+ }
+
+ private bool OnResourceFilter(object obj)
+ {
+ if (string.IsNullOrEmpty(filter))
+ return true;
+
+ if (obj is TreeNodes.ResourcesFileTreeNode.SerializedObjectRepresentation item)
+ return item.Key?.Contains(filter, StringComparison.OrdinalIgnoreCase) == true ||
+ item.Value?.Contains(filter, StringComparison.OrdinalIgnoreCase) == true;
+
+ return false; // make it obvious search is not working
}
private void OnParentSizeChanged(object sender, SizeChangedEventArgs e)
@@ -49,6 +70,12 @@ namespace ICSharpCode.ILSpy.Controls
MaxHeight = e.NewSize.Height;
}
+ private void OnFilterTextChanged(object sender, TextChangedEventArgs e)
+ {
+ filter = resourceFilterBox.Text;
+ filteredView?.Refresh();
+ }
+
void ExecuteCopy(object sender, ExecutedRoutedEventArgs args)
{
StringBuilder sb = new StringBuilder();
diff --git a/ILSpy/Controls/ResourceStringTable.xaml b/ILSpy/Controls/ResourceStringTable.xaml
index 3262de0b6..b2ce2127c 100644
--- a/ILSpy/Controls/ResourceStringTable.xaml
+++ b/ILSpy/Controls/ResourceStringTable.xaml
@@ -27,15 +27,21 @@
+
+
diff --git a/ILSpy/Controls/ResourceStringTable.xaml.cs b/ILSpy/Controls/ResourceStringTable.xaml.cs
index 5db68e561..d76df22a2 100644
--- a/ILSpy/Controls/ResourceStringTable.xaml.cs
+++ b/ILSpy/Controls/ResourceStringTable.xaml.cs
@@ -18,9 +18,12 @@
using System;
using System.Collections;
+using System.Collections.Generic;
+using System.ComponentModel;
using System.Text;
using System.Windows;
using System.Windows.Controls;
+using System.Windows.Data;
using System.Windows.Input;
namespace ICSharpCode.ILSpy.Controls
@@ -30,6 +33,9 @@ namespace ICSharpCode.ILSpy.Controls
///
public partial class ResourceStringTable : UserControl
{
+ ICollectionView filteredView;
+ string filter;
+
public ResourceStringTable(IEnumerable strings, FrameworkElement container)
{
InitializeComponent();
@@ -38,7 +44,22 @@ namespace ICSharpCode.ILSpy.Controls
if (!double.IsNaN(container.ActualWidth))
Width = Math.Max(container.ActualWidth - 45, 0);
MaxHeight = container.ActualHeight;
- resourceListView.ItemsSource = strings;
+
+ filteredView = CollectionViewSource.GetDefaultView(strings);
+ filteredView.Filter = OnResourceFilter;
+ resourceListView.ItemsSource = filteredView;
+ }
+
+ private bool OnResourceFilter(object obj)
+ {
+ if (string.IsNullOrEmpty(filter))
+ return true;
+
+ if (obj is KeyValuePair item)
+ return item.Key?.Contains(filter, StringComparison.OrdinalIgnoreCase) == true ||
+ item.Value?.Contains(filter, StringComparison.OrdinalIgnoreCase) == true;
+
+ return false; // make it obvious search is not working
}
private void OnParentSizeChanged(object sender, SizeChangedEventArgs e)
@@ -49,6 +70,12 @@ namespace ICSharpCode.ILSpy.Controls
MaxHeight = e.NewSize.Height;
}
+ private void OnFilterTextChanged(object sender, TextChangedEventArgs e)
+ {
+ filter = resourceFilterBox.Text;
+ filteredView?.Refresh();
+ }
+
void ExecuteCopy(object sender, ExecutedRoutedEventArgs args)
{
StringBuilder sb = new StringBuilder();
diff --git a/ILSpy/Properties/Resources.zh-Hans.resx b/ILSpy/Properties/Resources.zh-Hans.resx
index 041005759..0304ce446 100644
--- a/ILSpy/Properties/Resources.zh-Hans.resx
+++ b/ILSpy/Properties/Resources.zh-Hans.resx
@@ -1058,4 +1058,4 @@
窗口(_W)
-
+
\ No newline at end of file