I have problem with passing CommandParameter to my Command
I have command:
private Command<Boolean> _setAsCompletedCommand;
public Command<Boolean> SetAsCompletedCommand
{
get
{
return _setAsCompletedCommand ?? (_setAsCompletedCommand = new Command<Boolean>(isToComplete =>
{
if (isToComplete)
{
//do something
}
else
{
//do something else
}
}, isToComplete =>
{
if (isToComplete)
{
//check something
}
else
{
//check something else
}
}));
}
}
and I'm trying to pass system:Boolean like this:
<Button
Command="{Binding SetAsCompletedCommand}">
<Button.CommandParameter>
<system:Boolean>
True
</system:Boolean>
</Button.CommandParameter>
</Button>
The problem is that on construction of a View my SetAsCompletedCommand.CanExecute()
is executed with False
parameter.
How is it possible? How can I fix it?
When I click the button CommandParameter
is set properly to True
I'm using Catel framework as a MVVM framework in this project. But I don't think it produces the problem.