File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
src/MaterialDesignThemes.Wpf/Behaviors/Internal Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change 1- using System . Diagnostics ;
1+ using System . Diagnostics ;
22using System . Windows . Media . Animation ;
33using Microsoft . Xaml . Behaviors ;
44
@@ -41,11 +41,13 @@ private static void OnTabControlChanged(DependencyObject d, DependencyPropertyCh
4141 {
4242 oldTabControl . SelectionChanged -= behavior . OnTabChanged ;
4343 oldTabControl . SizeChanged -= behavior . OnTabControlSizeChanged ;
44+ oldTabControl . PreviewKeyDown -= behavior . OnTabControlPreviewKeyDown ;
4445 }
4546 if ( e . NewValue is TabControl newTabControl )
4647 {
4748 newTabControl . SelectionChanged += behavior . OnTabChanged ;
4849 newTabControl . SizeChanged += behavior . OnTabControlSizeChanged ;
50+ newTabControl . PreviewKeyDown += behavior . OnTabControlPreviewKeyDown ;
4951 }
5052 }
5153
@@ -110,6 +112,15 @@ private void AddPaddingToScrollableContentIfWiderThanViewPort()
110112 }
111113 }
112114
115+ private void OnTabControlPreviewKeyDown ( object sender , KeyEventArgs e )
116+ {
117+ if ( ! _isAnimatingScroll )
118+ return ;
119+
120+ if ( e . Key is Key . Left or Key . Right or Key . Home or Key . End or Key . PageUp or Key . PageDown )
121+ e . Handled = true ;
122+ }
123+
113124 protected override void OnAttached ( )
114125 {
115126 base . OnAttached ( ) ;
You can’t perform that action at this time.
0 commit comments