fix: add ScrollViewer event handler to disable scroll indicators based on scroll position

This commit is contained in:
Gadfly 2024-05-11 21:59:37 +08:00
parent e5516b5b9f
commit 0fcef2343a
No known key found for this signature in database
GPG key ID: 9128145F93CFC69C
2 changed files with 11 additions and 1 deletions

View file

@ -96,7 +96,8 @@
VerticalScrollBarVisibility="Disabled"
DoubleTapped="MaximizeOrRestoreWindow"
PointerPressed="BeginMoveWindow"
PointerWheelChanged="ScrollTabs">
PointerWheelChanged="ScrollTabs"
ScrollChanged="OnTabsScrollChanged">
<StackPanel x:Name="launcherTabsBar" Orientation="Horizontal" SizeChanged="UpdateScrollIndicator">
<ListBox Classes="launcher_page_tabbar"
ItemsSource="{Binding Pages}"

View file

@ -265,6 +265,15 @@ namespace SourceGit.Views
e.Handled = true;
}
private void OnTabsScrollChanged(object sender, ScrollChangedEventArgs e)
{
if (sender is ScrollViewer scrollViewer)
{
leftScrollIndicator.IsEnabled = scrollViewer.Offset.X > 0;
rightScrollIndicator.IsEnabled = scrollViewer.Offset.X < scrollViewer.Extent.Width - scrollViewer.Viewport.Width;
}
}
private void SetupDragAndDrop(object sender, RoutedEventArgs e)
{
if (sender is Border border)