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

Commit 401165e

Browse files
authored
Merge pull request #437 from /issues/409-scrollviewer-fix
Fix ScrollViewer
2 parents 507da9f + 98ee6e9 commit 401165e

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

src/GitHub.VisualStudio.UI/UI/Views/GitHubConnectContent.xaml.cs

+26
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using GitHub.Services;
77
using GitHub.Models;
88
using System;
9+
using System.Windows.Input;
910

1011
namespace GitHub.VisualStudio.UI.Views
1112
{
@@ -16,8 +17,33 @@ public GitHubConnectContent()
1617
InitializeComponent();
1718

1819
DataContextChanged += (s, e) => ViewModel = e.NewValue as IGitHubConnectSection;
20+
repositories.PreviewMouseWheel += Repositories_PreviewMouseWheel;
1921
}
2022

23+
void Repositories_PreviewMouseWheel(object sender, MouseWheelEventArgs e)
24+
{
25+
try
26+
{
27+
if (!e.Handled)
28+
{
29+
var uIElement = base.Parent as UIElement;
30+
31+
if (uIElement != null)
32+
{
33+
e.Handled = true;
34+
uIElement.RaiseEvent(new MouseWheelEventArgs(e.MouseDevice, e.Timestamp, e.Delta)
35+
{
36+
RoutedEvent = UIElement.MouseWheelEvent,
37+
Source = this
38+
});
39+
}
40+
}
41+
}
42+
catch
43+
{
44+
// TODO: Add trace logging: event handler called - who knows what can happen!
45+
}
46+
}
2147
void cloneLink_Click(object sender, RoutedEventArgs e)
2248
{
2349
cloneLink.IsEnabled = false;

0 commit comments

Comments
 (0)