From 1605d3a702efa393b7ff5324db52869b59662c04 Mon Sep 17 00:00:00 2001 From: robloo Date: Thu, 27 Jan 2022 11:30:16 -0500 Subject: [PATCH] Add back wanted SplitButton changes after reverting commits --- src/Avalonia.Controls/SplitButton/SplitButton.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Avalonia.Controls/SplitButton/SplitButton.cs b/src/Avalonia.Controls/SplitButton/SplitButton.cs index 6391812bed..13d3572975 100644 --- a/src/Avalonia.Controls/SplitButton/SplitButton.cs +++ b/src/Avalonia.Controls/SplitButton/SplitButton.cs @@ -271,12 +271,12 @@ namespace Avalonia.Controls if (_isAttachedToLogicalTree) { // Must unregister events here while a reference to the old command still exists - if (e.OldValue is ICommand oldCommand) + if (e.OldValue.GetValueOrDefault() is ICommand oldCommand) { oldCommand.CanExecuteChanged -= CanExecuteChanged; } - if (e.NewValue is ICommand newCommand) + if (e.NewValue.GetValueOrDefault() is ICommand newCommand) { newCommand.CanExecuteChanged += CanExecuteChanged; }