feat: always unregister event if possible.

This commit is contained in:
Dong Bin
2025-04-18 19:09:53 +08:00
parent 3eeba12d4f
commit 8eaafee693

View File

@@ -194,9 +194,9 @@ public class PopConfirm : ContentControl
var canExecute = command.CanExecute(button.CommandParameter);
if (canExecute)
{
command.CanExecuteChanged -= OnCanExecuteChanged;
_popup?.SetValue(Popup.IsOpenProperty, false);
}
command.CanExecuteChanged -= OnCanExecuteChanged;
}
command.CanExecuteChanged += OnCanExecuteChanged;