Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit 965af37

Browse files
committed
Ported changes from #1417 to PullRequestFilesView.
1 parent f2ee771 commit 965af37

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

src/GitHub.VisualStudio/Views/GitHubPane/PullRequestFilesView.xaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
BorderThickness="0"
4141
Margin="0 6 0 0"
4242
ContextMenuOpening="changesTree_ContextMenuOpening"
43+
KeyUp="changesTree_KeyUp"
4344
MouseDoubleClick="changesTree_MouseDoubleClick"
4445
MouseRightButtonDown="changesTree_MouseRightButtonDown">
4546
<TreeView.ItemContainerStyle>
@@ -57,7 +58,9 @@
5758
</HierarchicalDataTemplate>
5859

5960
<DataTemplate DataType="{x:Type vm:PullRequestFileNode}">
60-
<StackPanel Orientation="Horizontal" Tag="{Binding DataContext, ElementName=root}">
61+
<StackPanel Orientation="Horizontal"
62+
Tag="{Binding DataContext, ElementName=root}"
63+
KeyboardNavigation.DirectionalNavigation="None">
6164

6265
<!--
6366
We need to change the color of the file icon when the file is deleted, but applying the style

src/GitHub.VisualStudio/Views/GitHubPane/PullRequestFilesView.xaml.cs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ void changesTree_ContextMenuOpening(object sender, ContextMenuEventArgs e)
3232
void changesTree_MouseDoubleClick(object sender, MouseButtonEventArgs e)
3333
{
3434
var file = (e.OriginalSource as FrameworkElement)?.DataContext as IPullRequestFileNode;
35-
(DataContext as IPullRequestFilesViewModel)?.DiffFile.Execute(file);
35+
(DataContext as IPullRequestFilesViewModel)?.DiffFile.Execute(file);
3636
}
3737

3838
void changesTree_MouseRightButtonDown(object sender, MouseButtonEventArgs e)
@@ -70,5 +70,18 @@ void ApplyContextMenuBinding<TItem>(object sender, ContextMenuEventArgs e) where
7070
}
7171
}
7272
}
73+
74+
private void changesTree_KeyUp(object sender, KeyEventArgs e)
75+
{
76+
if (e.Key == Key.Return)
77+
{
78+
var file = (e.OriginalSource as FrameworkElement)?.DataContext as IPullRequestFileNode;
79+
80+
if (file != null)
81+
{
82+
(DataContext as IPullRequestFilesViewModel)?.DiffFile.Execute(file);
83+
}
84+
}
85+
}
7386
}
7487
}

0 commit comments

Comments
 (0)