Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -336,13 +336,14 @@ private void AssociatedObject_ScrollChanged(object sender, ScrollChangedEventArg
return;
if ( _isAnimatingScroll || _desiredScrollStart is not { } desiredOffsetStart)
return;
if (!TabControl.IsHitTestVisible)
return;

double originalValue = desiredOffsetStart;
double newValue = e.HorizontalOffset;
_isAnimatingScroll = true;

// HACK: Temporarily disable user interaction while the animated scroll is ongoing. This prevents the double-click of a tab stopping the animation prematurely.
bool originalIsHitTestVisibleValue = TabControl.IsHitTestVisible;
TabControl.SetCurrentValue(FrameworkElement.IsHitTestVisibleProperty, false);

AssociatedObject.ScrollToHorizontalOffset(originalValue);
Expand All @@ -355,8 +356,8 @@ private void AssociatedObject_ScrollChanged(object sender, ScrollChangedEventArg
_desiredScrollStart = null;
_isAnimatingScroll = false;

// HACK: Set the hit test visibility back to its original value
TabControl.SetCurrentValue(FrameworkElement.IsHitTestVisibleProperty, originalIsHitTestVisibleValue);
// HACK: Re-enable hit test visibility
TabControl.SetCurrentValue(FrameworkElement.IsHitTestVisibleProperty, true);
};
AssociatedObject.BeginAnimation(TabControlHeaderScrollBehavior.CustomHorizontalOffsetProperty, scrollAnimation);
}
Expand Down
Loading