@@ -25,6 +25,8 @@ namespace Files.UserControls
2525 public sealed partial class HorizontalMultitaskingControl : UserControl , IMultitaskingControl
2626 {
2727 private const string TabDropHandledIdentifier = "FilesTabViewItemDropHandled" ;
28+ private readonly DispatcherTimer tabHoverTimer = new DispatcherTimer ( ) ;
29+ private TabViewItem hoveredTabViewItem = null ;
2830
2931 public const string TabPathIdentifier = "FilesTabViewItemPath" ;
3032
@@ -33,10 +35,7 @@ public sealed partial class HorizontalMultitaskingControl : UserControl, IMultit
3335 public void SelectionChanged ( ) => TabStrip_SelectionChanged ( null , null ) ;
3436
3537 public ObservableCollection < TabItem > Items => MainPage . AppInstances ;
36-
37- private readonly DispatcherTimer tabHoverTimer = new DispatcherTimer ( ) ;
38- private TabViewItem hoveredTabViewItem = null ;
39-
38+
4039 public HorizontalMultitaskingControl ( )
4140 {
4241 this . InitializeComponent ( ) ;
@@ -225,7 +224,7 @@ private void HorizontalTabView_TabItemsChanged(TabView sender, Windows.Foundatio
225224 break ;
226225
227226 case Windows . Foundation . Collections . CollectionChange . ItemInserted :
228- App . InteractionViewModel . TabStripSelectedIndex = Items . IndexOf ( HorizontalTabView . SelectedItem as TabItem ) ;
227+ App . InteractionViewModel . TabStripSelectedIndex = ( int ) args . Index ;
229228 break ;
230229 }
231230 }
@@ -279,7 +278,9 @@ private void TabHoverSelected(object sender, object e)
279278 {
280279 tabHoverTimer . Stop ( ) ;
281280 if ( hoveredTabViewItem != null )
281+ {
282282 HorizontalTabView . SelectedItem = hoveredTabViewItem ;
283+ }
283284 }
284285
285286 private void TabStrip_TabDragStarting ( TabView sender , TabViewTabDragStartingEventArgs args )
@@ -298,7 +299,8 @@ private void TabStrip_TabStripDragOver(object sender, DragEventArgs e)
298299 e . DragUIOverride . Caption = ResourceController . GetTranslation ( "TabStripDragAndDropUIOverrideCaption" ) ;
299300 e . DragUIOverride . IsCaptionVisible = true ;
300301 e . DragUIOverride . IsGlyphVisible = false ;
301- } else
302+ }
303+ else
302304 {
303305 HorizontalTabView . CanReorderTabs = false ;
304306 }
0 commit comments