@@ -18,6 +18,7 @@ public sealed partial class TabBar : BaseTabBar, INotifyPropertyChanged
1818
1919 private readonly ICommandManager Commands = Ioc . Default . GetRequiredService < ICommandManager > ( ) ;
2020 private readonly IAppearanceSettingsService AppearanceSettingsService = Ioc . Default . GetRequiredService < IAppearanceSettingsService > ( ) ;
21+ private readonly IWindowContext WindowContext = Ioc . Default . GetRequiredService < IWindowContext > ( ) ;
2122
2223 // Fields
2324
@@ -44,12 +45,8 @@ public sealed partial class TabBar : BaseTabBar, INotifyPropertyChanged
4445 public bool ShowTabActionsButton
4546 => AppearanceSettingsService . ShowTabActions ;
4647
47- // Dragging makes the app crash when run as admin.
48- // For more information:
49- // - https://github.com/files-community/Files/issues/12390
50- // - https://github.com/microsoft/terminal/issues/12017#issuecomment-1004129669
5148 public bool AllowTabsDrag
52- => ! ElevationHelpers . IsAppRunAsAdmin ( ) ;
49+ => WindowContext . CanDragAndDrop ;
5350
5451 public Rectangle DragArea
5552 => DragAreaRectangle ;
@@ -172,7 +169,7 @@ private void TabView_TabStripDragOver(object sender, DragEventArgs e)
172169 {
173170 if ( e . DataView . Properties . ContainsKey ( TabPathIdentifier ) )
174171 {
175- HorizontalTabView . CanReorderTabs = true && ! ElevationHelpers . IsAppRunAsAdmin ( ) ;
172+ HorizontalTabView . CanReorderTabs = WindowContext . CanDragAndDrop ;
176173
177174 e . AcceptedOperation = DataPackageOperation . Move ;
178175 e . DragUIOverride . Caption = "TabStripDragAndDropUIOverrideCaption" . GetLocalizedResource ( ) ;
@@ -187,12 +184,12 @@ private void TabView_TabStripDragOver(object sender, DragEventArgs e)
187184
188185 private void TabView_DragLeave ( object sender , DragEventArgs e )
189186 {
190- HorizontalTabView . CanReorderTabs = true && ! ElevationHelpers . IsAppRunAsAdmin ( ) ;
187+ HorizontalTabView . CanReorderTabs = WindowContext . CanDragAndDrop ;
191188 }
192189
193190 private async void TabView_TabStripDrop ( object sender , DragEventArgs e )
194191 {
195- HorizontalTabView . CanReorderTabs = true && ! ElevationHelpers . IsAppRunAsAdmin ( ) ;
192+ HorizontalTabView . CanReorderTabs = WindowContext . CanDragAndDrop ;
196193
197194 if ( ! ( sender is TabView tabStrip ) )
198195 return ;
0 commit comments