diff --git a/src/Caliburn.Micro.Platform/ActionMessage.cs b/src/Caliburn.Micro.Platform/ActionMessage.cs index 8e09cf48..cb4aa587 100644 --- a/src/Caliburn.Micro.Platform/ActionMessage.cs +++ b/src/Caliburn.Micro.Platform/ActionMessage.cs @@ -315,8 +315,9 @@ void ElementLoaded(object sender, RoutedEventArgs e) Log.Info($"Binding {binding.Source}"); #elif (NET || CAL_NETCORE) && !WinUI3 && !WINDOWS_UWP - var binding = new Binding { - Path = new PropertyPath(Message.HandlerProperty), + var binding = new Binding + { + Path = new PropertyPath(Message.HandlerProperty), Source = currentElement }; #elif WINDOWS_UWP || WinUI3 @@ -536,7 +537,23 @@ public override string ToString() if (!hasBinding && context.CanExecute != null) { Log.Info($"ApplyAvailabilityEffect CanExecute {context.CanExecute()} - {context.Method.Name}"); - source.IsEnabled = context.CanExecute(); + if (!string.IsNullOrEmpty(source.Name)) + { + Log.Info($"ApplyAvailabilityEffect CanExecute {context.CanExecute()} - {context.Method.Name} - {source.Name}"); + source.IsEnabled = context.CanExecute(); + } + else + { + Log.Info("Skipping IsEnabled source because source Name is not set"); + } + if (!source.IsEnabled) + { + Log.Info($"Disabled {source.Name}"); + } + else + { + Log.Info($"Enabled {source.Name}"); + } } #endif Log.Info($"ApplyAvailabilityEffect source enabled {source.IsEnabled}"); @@ -615,6 +632,7 @@ public override string ToString() } } #else + if (source != null && source.DataContext != null) { var target = source.DataContext;