-
Notifications
You must be signed in to change notification settings - Fork 363
Closed as not planned
Labels
by designSome behavior that is intended and not an issueSome behavior that is intended and not an issuemvvm-toolkit 🧰Issues/PRs for the MVVM ToolkitIssues/PRs for the MVVM Toolkit
Description
Is there an existing issue for this?
- I have searched the existing issues
Current Behavior
Hi all,
I've created a new relaycommand like this here:
private bool ResetFormCanExecute()
{
return !ImageLoading;
}
[RelayCommand(CanExecute = nameof(ResetFormCanExecute))]
private async void ResetForm(bool alert = false)
{
if (alert && !(await _messageService.DisplayAlert("Reset", "Alles zurücksetzen?")))
return;
ScannedData = string.Empty;
Comment = string.Empty;
foreach (var item in Items)
{
System.IO.File.Delete(item.FilePath);
}
Items.Clear();
}
XAML:
<Button Text="Formular zurücksetzen"
Command="{Binding ResetFormCommand}"
Margin="0,25,0,0"
Background="{DynamicResource Gray400}"></Button>
The tooltip shows me a binding to IRelayCommand'1 but the other commands have a binding to IRelayCommand.
In my case, the Command will not execute and the canExecute method also not execute.
If I remove the parameter "bool alert = false" the relaycommand works.
Expected Behavior
Accepting a methods for RelayCommands with default parameters.
Steps To Reproduce
Create a RelayCommand with default parameters.
Link to public reproduction project repository
https://github.com/DavidStania/RelayCommandFail.git
Environment
- .NET MAUI CommunityToolkit: CommunityToolkit.Mvvm 8.1.0-preview1
- OS: Microsoft Windows 11 Pro 10.0.22621 Build 22621
- .NET MAUI: 7.0Anything else?
No response
CodingOctocat
Metadata
Metadata
Assignees
Labels
by designSome behavior that is intended and not an issueSome behavior that is intended and not an issuemvvm-toolkit 🧰Issues/PRs for the MVVM ToolkitIssues/PRs for the MVVM Toolkit