diff --git a/src/FodyWeavers.xml b/src/FodyWeavers.xml
index c371fb7..4408623 100644
--- a/src/FodyWeavers.xml
+++ b/src/FodyWeavers.xml
@@ -1,4 +1,5 @@
+
\ No newline at end of file
diff --git a/src/NuGetMonitor.csproj b/src/NuGetMonitor.csproj
index e35cdaa..b73e9d9 100644
--- a/src/NuGetMonitor.csproj
+++ b/src/NuGetMonitor.csproj
@@ -24,7 +24,8 @@
-
+
+
diff --git a/src/View/DependencyTree/DependencyTreeControl.xaml b/src/View/DependencyTree/DependencyTreeControl.xaml
index 66d66dd..152447d 100644
--- a/src/View/DependencyTree/DependencyTreeControl.xaml
+++ b/src/View/DependencyTree/DependencyTreeControl.xaml
@@ -8,9 +8,9 @@
xmlns:styles="urn:TomsToolbox.Wpf.Styles"
xmlns:imaging="clr-namespace:Microsoft.VisualStudio.Imaging;assembly=Microsoft.VisualStudio.Imaging"
xmlns:imageCatalog="clr-namespace:Microsoft.VisualStudio.Imaging;assembly=Microsoft.VisualStudio.ImageCatalog"
- xmlns:view="clr-namespace:NuGetMonitor.View"
mc:Ignorable="d"
- d:DesignHeight="450" d:DesignWidth="800">
+ d:DesignHeight="450" d:DesignWidth="800"
+ TextOptions.TextFormattingMode="Display">
@@ -20,20 +20,22 @@
4
+
+
-
-
-
-
-
-
+
+
+
@@ -41,6 +43,46 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -53,39 +95,15 @@
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ ItemsSource="{Binding TransitivePackages}"
+ ItemContainerStyle="{StaticResource ExpandedNodeStyle}"
+ VirtualizingStackPanel.IsVirtualizing="True"
+ VirtualizingStackPanel.VirtualizationMode="Recycling" />
diff --git a/src/View/DependencyTree/DependencyTreeViewModel.cs b/src/View/DependencyTree/DependencyTreeViewModel.cs
index 76fe1ef..d1a33f6 100644
--- a/src/View/DependencyTree/DependencyTreeViewModel.cs
+++ b/src/View/DependencyTree/DependencyTreeViewModel.cs
@@ -1,12 +1,16 @@
using Community.VisualStudio.Toolkit;
using NuGetMonitor.Services;
using System.ComponentModel;
+using System.Windows.Data;
using System.Windows.Input;
using Microsoft.VisualStudio.Shell;
using NuGet.Frameworks;
using NuGetMonitor.Models;
using TomsToolbox.Wpf;
using NuGet.Packaging.Core;
+using PropertyChanged;
+using Throttle;
+using TomsToolbox.Essentials;
namespace NuGetMonitor.View.DependencyTree;
@@ -59,19 +63,36 @@ private IEnumerable GetIssueItems()
internal sealed partial class RootNode : INotifyPropertyChanged
{
private readonly TransitiveDependencies _transitiveDependencies;
+ private readonly ListCollectionView _children;
public RootNode(TransitiveDependencies transitiveDependencies)
{
_transitiveDependencies = transitiveDependencies;
+
+ var children = _transitiveDependencies.ParentsByChild
+ .OrderBy(item => item.Key.PackageIdentity)
+ .Select(item => new ChildNode(item.Key, _transitiveDependencies.ParentsByChild))
+ .ToArray();
+
+ _children = new ListCollectionView(children);
}
public string ProjectName => _transitiveDependencies.ProjectName;
public NuGetFramework TargetFramework => _transitiveDependencies.TargetFramework;
- public IEnumerable Children => _transitiveDependencies.ParentsByChild
- .OrderBy(item => item.Key.PackageIdentity)
- .Select(item => new ChildNode(item.Key, _transitiveDependencies.ParentsByChild));
+ public ICollectionView Children => _children;
+
+ public void SetFilter(string? searchText)
+ {
+ if (searchText.IsNullOrWhiteSpace())
+ {
+ _children.Filter = null;
+ return;
+ }
+
+ _children.Filter = item => ((ChildNode)item).PackageIdentity.ToString().IndexOf(searchText, StringComparison.OrdinalIgnoreCase) >= 0;
+ }
}
#pragma warning disable CA1812 // Avoid uninstantiated internal classes => used in xaml!
@@ -90,6 +111,15 @@ public DependencyTreeViewModel()
public ICommand RefreshCommand => new DelegateCommand(Refresh);
+ [OnChangedMethod(nameof(OnSearchTextChanged))]
+ public string? SearchText { get; set; }
+
+ [Throttled(typeof(TomsToolbox.Wpf.Throttle), 200)]
+ private void OnSearchTextChanged()
+ {
+ TransitivePackages?.ForEach(item => item.SetFilter(SearchText));
+ }
+
private void Refresh()
{
ProjectService.ClearCache();
@@ -97,7 +127,7 @@ private void Refresh()
Load().FireAndForget();
}
- public async Task Load()
+ private async Task Load()
{
try
{
@@ -115,7 +145,10 @@ public async Task Load()
TransitivePackages = transitivePackages
.OrderBy(item => item.ProjectName)
.ThenBy(item => item.TargetFramework.ToString())
- .Select(item => new RootNode(item)).ToArray();
+ .Select(item => new RootNode(item))
+ .ToArray();
+
+ OnSearchTextChanged();
}
finally
{