Browse Source

Fix focus when switching back to assembly list via keyboard

pull/3297/head
tom-englert 7 months ago
parent
commit
5a1ec2ca55
  1. 4
      ILSpy/AssemblyTree/AssemblyListPane.xaml
  2. 17
      ILSpy/AssemblyTree/AssemblyListPane.xaml.cs

4
ILSpy/AssemblyTree/AssemblyListPane.xaml

@ -7,6 +7,7 @@ @@ -7,6 +7,7 @@
xmlns:treeNodes="clr-namespace:ICSharpCode.ILSpy.TreeNodes"
xmlns:assemblyTree="clr-namespace:ICSharpCode.ILSpy.AssemblyTree"
xmlns:toms="urn:TomsToolbox"
xmlns:viewModels="clr-namespace:ICSharpCode.ILSpy.ViewModels"
mc:Ignorable="d" d:DesignHeight="450" d:DesignWidth="800"
d:DataContext="{d:DesignInstance assemblyTree:AssemblyTreeModel}"
AutomationProperties.Name="Assemblies and Classes"
@ -15,7 +16,8 @@ @@ -15,7 +16,8 @@
AllowDrop="True"
BorderThickness="0" Visibility="Visible"
Root="{Binding Root}"
toms:MultiSelectorExtensions.SelectionBinding="{Binding SelectedItems, Mode=TwoWay}">
toms:MultiSelectorExtensions.SelectionBinding="{Binding SelectedItems, Mode=TwoWay}"
viewModels:Pane.IsActive="{Binding IsActive}">
<treeView:SharpTreeView.ItemContainerStyle>
<Style TargetType="treeView:SharpTreeViewItem">
<Setter Property="Template">

17
ILSpy/AssemblyTree/AssemblyListPane.xaml.cs

@ -20,6 +20,9 @@ using System.ComponentModel.Composition; @@ -20,6 +20,9 @@ using System.ComponentModel.Composition;
using System.Windows;
using System.Windows.Threading;
using ICSharpCode.ILSpy.ViewModels;
using ICSharpCode.ILSpyX.TreeView;
using TomsToolbox.Wpf.Composition.Mef;
namespace ICSharpCode.ILSpy.AssemblyTree
@ -59,6 +62,20 @@ namespace ICSharpCode.ILSpy.AssemblyTree @@ -59,6 +62,20 @@ namespace ICSharpCode.ILSpy.AssemblyTree
});
}
}
else if (e.Property == Pane.IsActiveProperty)
{
if (!true.Equals(e.NewValue))
return;
if (SelectedItem is SharpTreeNode selectedItem)
{
FocusNode(selectedItem);
}
else
{
Focus();
}
}
}
}
}

Loading…
Cancel
Save