Skip to content
Merged
Show file tree
Hide file tree
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
13 changes: 10 additions & 3 deletions src/Files.App/Views/Layouts/DetailsLayoutPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ public sealed partial class DetailsLayoutPage : BaseGroupableLayoutPage
/// </summary>
private uint currentIconSize;

private RectangleSelection? _rectangleSelection;

// Properties

protected override ListViewBase ListViewBase => FileList;
Expand Down Expand Up @@ -77,8 +79,8 @@ public DetailsLayoutPage() : base()
{
InitializeComponent();
DataContext = this;
var selectionRectangle = RectangleSelection.Create(FileList, SelectionRectangle, FileList_SelectionChanged);
selectionRectangle.SelectionEnded += SelectionRectangle_SelectionEnded;
_rectangleSelection = RectangleSelection.Create(FileList, SelectionRectangle, FileList_SelectionChanged);
_rectangleSelection.SelectionEnded += SelectionRectangle_SelectionEnded;

UpdateSortOptionsCommand = new RelayCommand<string>(x =>
{
Expand Down Expand Up @@ -202,6 +204,11 @@ protected override void OnNavigatingFrom(NavigatingCancelEventArgs e)
FolderSettings.SortOptionPreferenceUpdated -= FolderSettings_SortOptionPreferenceUpdated;
ParentShellPageInstance.ShellViewModel.PageTypeUpdated -= FilesystemViewModel_PageTypeUpdated;
UserSettingsService.LayoutSettingsService.PropertyChanged -= LayoutSettingsService_PropertyChanged;
if (_rectangleSelection is not null)
{
_rectangleSelection.SelectionEnded -= SelectionRectangle_SelectionEnded;
_rectangleSelection = null;
}
}

private void LayoutSettingsService_PropertyChanged(object? sender, PropertyChangedEventArgs e)
Expand Down Expand Up @@ -1053,4 +1060,4 @@ private static GitProperties GetEnabledGitProperties(ColumnsViewModel columnsVie
};
}
}
}
}
14 changes: 11 additions & 3 deletions src/Files.App/Views/Layouts/GridLayoutPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ public sealed partial class GridLayoutPage : BaseGroupableLayoutPage

private volatile bool shouldSetVerticalScrollMode;

private RectangleSelection? _rectangleSelection;

// Properties

public ScrollViewer? ContentScroller { get; private set; }
Expand Down Expand Up @@ -149,8 +151,8 @@ public GridLayoutPage() : base()
InitializeComponent();
DataContext = this;

var selectionRectangle = RectangleSelection.Create(ListViewBase, SelectionRectangle, FileList_SelectionChanged);
selectionRectangle.SelectionEnded += SelectionRectangle_SelectionEnded;
_rectangleSelection = RectangleSelection.Create(ListViewBase, SelectionRectangle, FileList_SelectionChanged);
_rectangleSelection.SelectionEnded += SelectionRectangle_SelectionEnded;
}

// Methods
Expand Down Expand Up @@ -222,6 +224,12 @@ protected override void OnNavigatingFrom(NavigatingCancelEventArgs e)
FolderSettings.LayoutModeChangeRequested -= FolderSettings_LayoutModeChangeRequested;

UserSettingsService.LayoutSettingsService.PropertyChanged -= LayoutSettingsService_PropertyChanged;

if (_rectangleSelection is not null)
{
_rectangleSelection.SelectionEnded -= SelectionRectangle_SelectionEnded;
_rectangleSelection = null;
}
}

private void LayoutSettingsService_PropertyChanged(object? sender, PropertyChangedEventArgs e)
Expand Down Expand Up @@ -827,4 +835,4 @@ private void UpdateCheckboxVisibility(object sender, bool isPointerOver)
}
}
}
}
}
Loading