This commit is contained in:
Jeffrey Ye 2018-12-18 00:53:18 -08:00
Родитель c8416ed391
Коммит 400b044f10
3 изменённых файлов: 41 добавлений и 8 удалений

Просмотреть файл

@ -34,8 +34,8 @@ namespace ICSharpCode.ILSpy
public static class NavigationCommands
{
public static RoutedCommand BrowseBack { get; } = new RoutedCommand(nameof(BrowseBack), new KeyGesture { Modifiers = InputModifiers.Control, Key = Key.BrowserBack });
public static RoutedCommand BrowseForward { get; } = new RoutedCommand(nameof(BrowseForward), new KeyGesture { Modifiers = InputModifiers.Control, Key = Key.BrowserForward });
public static RoutedCommand BrowseBack { get; } = new NavigationCommand(nameof(BrowseBack), new KeyGesture { Modifiers = InputModifiers.Control, Key = Key.BrowserBack });
public static RoutedCommand BrowseForward { get; } = new NavigationCommand(nameof(BrowseForward), new KeyGesture { Modifiers = InputModifiers.Control, Key = Key.BrowserForward });
public static RoutedCommand Search { get; } = new RoutedCommand(nameof(Search), new KeyGesture { Modifiers = InputModifiers.Control | InputModifiers.Shift, Key = Key.F });
}

Просмотреть файл

@ -0,0 +1,36 @@
using System;
using System.Windows.Input;
using Avalonia.Input;
using Avalonia.Interactivity;
using AvaloniaEdit;
namespace ICSharpCode.ILSpy
{
/// <summary>
/// Navigation command. CanExecuteChanged will get called when focused is changed.
/// </summary>
internal class NavigationCommand: RoutedCommand, ICommand
{
static EventHandler interactiveEventHandler;
static NavigationCommand()
{
InputElement.GotFocusEvent.AddClassHandler(typeof(InputElement), HandlePointerEvent);
}
public NavigationCommand(string name, KeyGesture keyGesture) : base(name, keyGesture)
{
}
private static void HandlePointerEvent(object sender, RoutedEventArgs args)
{
interactiveEventHandler?.Invoke(sender, args);
}
event EventHandler ICommand.CanExecuteChanged
{
add { interactiveEventHandler += value; }
remove { interactiveEventHandler -= value; }
}
}
}

Просмотреть файл

@ -257,9 +257,6 @@ namespace ICSharpCode.TreeView
if (doNotScrollOnExpanding)
return;
// TODO: make sure node is materialized
return;
SharpTreeNode lastVisibleChild = node;
while (true) {
SharpTreeNode tmp = lastVisibleChild.Children.LastOrDefault(c => c.IsVisible);
@ -301,10 +298,10 @@ namespace ICSharpCode.TreeView
if (!container.Node.IsExpanded && container.Node.ShowExpander) {
container.Node.IsExpanded = true;
} else if (container.Node.Children.Count > 0) {
// jump to first child:
// jump to first child:
//container.MoveFocus(new TraversalRequest(FocusNavigationDirection.Down));
}
//container.MoveFocus(new TraversalRequest(FocusNavigationDirection.Down));
}
e.Handled = true;
}
break;