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

Commit 022271e

Browse files
committed
Navigate to PR with enter key from PR list.
1 parent f59a513 commit 022271e

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,8 @@
109109
BorderThickness="0"
110110
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
111111
Visibility="{Binding Message, Converter={ghfvs:EqualsToVisibilityConverter None}}"
112-
ContextMenuOpening="ListBox_ContextMenuOpening">
112+
ContextMenuOpening="ListBox_ContextMenuOpening"
113+
KeyDown="ListBox_KeyDown">
113114
<ListBox.ContextMenu>
114115
<ContextMenu>
115116
<MenuItem Header="{x:Static prop:Resources.Open}" Command="{Binding OpenItem}"/>

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

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,18 @@ void OpenInBrowser(IPullRequestListItemViewModel item)
5858
}
5959
}
6060

61+
void ListBox_KeyDown(object sender, KeyEventArgs e)
62+
{
63+
var listBox = (ListBox)sender;
64+
65+
if (listBox.SelectedItem != null && e.Key == Key.Enter)
66+
{
67+
var vm = DataContext as IPullRequestListViewModel;
68+
var pr = (IPullRequestListItemViewModel)listBox.SelectedItem;
69+
vm.OpenItem.Execute(pr);
70+
}
71+
}
72+
6173
void ListBoxItem_MouseDoubleClick(object sender, MouseButtonEventArgs e)
6274
{
6375
var control = sender as ListBoxItem;
@@ -100,7 +112,7 @@ void ApplyContextMenuBinding<TItem>(object sender, ContextMenuEventArgs e) where
100112
}
101113
}
102114

103-
private Visual GetVisual(object element)
115+
Visual GetVisual(object element)
104116
{
105117
if (element is Visual v)
106118
{

0 commit comments

Comments
 (0)