Skip to content

Commit 6bbe47c

Browse files
authored
Feature: Added support for cycling tabs via mouse scrolling (#14123)
1 parent 2e6238d commit 6bbe47c

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

src/Files.App/UserControls/TabBar/TabBar.xaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
CanReorderTabs="{x:Bind AllowTabsDrag, Mode=OneWay}"
7575
DragLeave="TabView_DragLeave"
7676
IsAddTabButtonVisible="False"
77+
PointerWheelChanged="TabView_PointerWheelChanged"
7778
SelectedIndex="{x:Bind root:App.AppModel.TabStripSelectedIndex, Mode=TwoWay}"
7879
SelectionChanged="TabView_SelectionChanged"
7980
TabCloseRequested="TabView_TabCloseRequested"

src/Files.App/UserControls/TabBar/TabBar.xaml.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,26 @@ private async void TabView_TabDroppedOutside(TabView sender, TabViewTabDroppedOu
266266
(args.Item as TabBarItem)?.Unload();
267267
}
268268

269+
private void TabView_PointerWheelChanged(object sender, PointerRoutedEventArgs e)
270+
{
271+
var delta = e.GetCurrentPoint(null).Properties.MouseWheelDelta;
272+
273+
if (delta > 0)
274+
{
275+
// Scroll up, select the next tab
276+
if (HorizontalTabView.SelectedIndex < HorizontalTabView.TabItems.Count - 1)
277+
HorizontalTabView.SelectedIndex++;
278+
}
279+
else
280+
{
281+
// Scroll down, select the previous tab
282+
if (HorizontalTabView.SelectedIndex > 0)
283+
HorizontalTabView.SelectedIndex--;
284+
}
285+
286+
e.Handled = true;
287+
}
288+
269289
private void TabItemContextMenu_Opening(object sender, object e)
270290
{
271291
MenuItemMoveTabToNewWindow.IsEnabled = Items.Count > 1;

0 commit comments

Comments
 (0)