Skip to content

Commit 14c0ff7

Browse files
committed
Allow scrolling while inside DataGrid
1 parent 6d4087b commit 14c0ff7

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

Rubberduck.Core/UI/Settings/AutoCompleteSettings.xaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@
5151
<RowDefinition Height="*" />
5252
<RowDefinition Height="32" />
5353
</Grid.RowDefinitions>
54-
<ScrollViewer Grid.Row="0">
54+
<ScrollViewer x:Name="ScrollViewer"
55+
Grid.Row="0">
5556
<StackPanel Margin="5,5,5,0" ScrollViewer.VerticalScrollBarVisibility="Auto">
5657
<Label Background="DarkGray"
5758
HorizontalContentAlignment="Stretch"
@@ -93,7 +94,7 @@
9394
<CheckBox IsEnabled="{Binding IsEnabled}" Margin="10,10" IsChecked="{Binding EnableSmartConcat}" HorizontalAlignment="Center" Content="{Resx ResxName=Rubberduck.Resources.Settings.AutoCompletesPage, Key=EnableSmartConcat}" />
9495
</WrapPanel>
9596
<Border BorderBrush="DarkGray" BorderThickness="1" CornerRadius="2">
96-
<DataGrid Name="AutoCompleteSettingsGrid"
97+
<DataGrid PreviewMouseWheel="AutoCompleteSettingsGrid_PreviewMouseWheel"
9798
ItemsSource="{Binding Settings}"
9899
AutoGenerateColumns="False"
99100
CanUserReorderColumns="False"

Rubberduck.Core/UI/Settings/AutoCompleteSettings.xaml.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,25 @@ public AutoCompleteSettings(ISettingsViewModel vm) : this()
3131
}
3232

3333
public ISettingsViewModel ViewModel => DataContext as ISettingsViewModel;
34+
35+
private void AutoCompleteSettingsGrid_PreviewMouseWheel(object sender, MouseWheelEventArgs e)
36+
{
37+
if (e.Delta > 0)
38+
{
39+
for (int i = 0; i < 3; i++)
40+
{
41+
ScrollViewer.LineUp();
42+
}
43+
}
44+
else
45+
{
46+
for (int i = 0; i < 3; i++)
47+
{
48+
ScrollViewer.LineDown();
49+
}
50+
}
51+
52+
e.Handled = true;
53+
}
3454
}
3555
}

0 commit comments

Comments
 (0)