Skip to content
Merged
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
18 changes: 13 additions & 5 deletions Files/Views/LayoutModes/GenericFileBrowser.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -251,9 +251,14 @@ private void AllView_PreparingCellForEdit(object sender, DataGridPreparingCellFo

if (AppSettings.DoubleTapToRenameFiles == false) // Check if the double tap to rename files setting is off
{
AllView.CancelEdit(); // Cancel the edit operation
App.CurrentInstance.InteractionOperations.OpenItem_Click(null, null); // Open the file instead
return;
// Only cancel if this event was triggered by a tap
// Do not cancel when user presses F2 or context menu
if (e.EditingEventArgs is TappedRoutedEventArgs)
{
AllView.CancelEdit(); // Cancel the edit operation
App.CurrentInstance.InteractionOperations.OpenItem_Click(null, null); // Open the file instead
return;
}
}

int extensionLength = SelectedItem.FileExtension?.Length ?? 0;
Expand Down Expand Up @@ -288,7 +293,7 @@ private void TextBox_TextChanged(object sender, TextChangedEventArgs e)

private async void AllView_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
{
if (e.EditAction == DataGridEditAction.Cancel)
if (e.EditAction == DataGridEditAction.Cancel || renamingTextBox == null)
{
return;
}
Expand All @@ -308,7 +313,10 @@ private async void AllView_CellEditEnding(object sender, DataGridCellEditEndingE

private void AllView_CellEditEnded(object sender, DataGridCellEditEndedEventArgs e)
{
renamingTextBox.TextChanged -= TextBox_TextChanged;
if (renamingTextBox != null)
{
renamingTextBox.TextChanged -= TextBox_TextChanged;
}
FileNameTeachingTip.IsOpen = false;
isRenamingItem = false;
}
Expand Down