-
Notifications
You must be signed in to change notification settings - Fork 452
Open
Labels
Description
Is there an existing issue for this?
- I have searched the existing issues
Did you read the "Reporting a bug" section on Contributing file?
- I have read the "Reporting a bug" section on Contributing file: https://github.com/CommunityToolkit/Maui/blob/main/CONTRIBUTING.md#reporting-a-bug
Current Behavior
As observed in the source code, only when the command instance explicitly defines a CanExecute value will the behavior execute the command.
Expected Behavior
Commands that don't define CanExecute because they are always valid to execute should also be executed when the behavior proxies a raised event.
Steps To Reproduce
- Create a Command without a CanExecute delegate
- Add an EventToCommandBehavior to a view, binding to the command
- Raise the proxied event
public ICommand TestCommand { get; }
public TestViewModel(...)
{
TestCommand = new Command(ExecuteMethod);
}
public void ExecuteMethod(object? parameter)
{
Console.WriteLine("You won't see this");
}
Link to public reproduction project repository
no
Environment
- .NET MAUI CommunityToolkit: 12.2.0
- OS: Win11 x64 23H2 build 22631.5699
- .NET MAUI: 9.0.100
Anything else?
This worked fine in Xamarin.Essentials with XF 5.x so this is a frustrating regression as I upgrade my app on a tight time table.