refactor(ui): harden double-click edit handlers

Remove redundant SelectedList/SelectedTask assignments (single-tap already
updated selection via binding) and CanExecute guards (always true for
unconditional [RelayCommand]). Set e.Handled = true to stop DoubleTapped
from bubbling to the ListBox.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Mika Kuns
2026-04-13 15:04:19 +02:00
parent db5a447b12
commit 6727cc4e9d
2 changed files with 6 additions and 8 deletions

View File

@@ -20,12 +20,11 @@ public partial class MainWindow : Window
private void OnListItemDoubleTapped(object? sender, TappedEventArgs e)
{
if (sender is Control c && c.DataContext is ListItemViewModel item
if (sender is Control c && c.DataContext is ListItemViewModel
&& DataContext is MainWindowViewModel vm)
{
vm.SelectedList = item;
if (vm.EditListCommand.CanExecute(null))
vm.EditListCommand.Execute(null);
vm.EditListCommand.Execute(null);
e.Handled = true;
}
}
}