Open logeshpalani33 opened 3 years ago
CheckChangedCommand is type of ICommand
.
So, CheckChangedCommandProperty casts value to ICommand
when parameter is set:
https://github.com/enisn/Xamarin.Forms.InputKit/blob/af149c3ab9f28a69de6c0e57ef05482411f1cb0a/InputKit/Shared/Controls/CheckBox.cs#L225
I'm not sure why it doesn't work. I can try to reproduce later.
I've found a note in prism documentation
The DelegateCommand deliberately prevents the use of value types (int, double, bool, etc). Because ICommand takes an object, having a value type for T would cause unexpected behavior when CanExecute(null) is called during XAML initialization for command bindings. Using default(T) was considered and rejected as a solution because the implementor would not be able to distinguish between a valid and defaulted values. If you wish to use a value type as a parameter, you must make it nullable by using DelegateCommand<Nullable
> or the shorthand ? syntax (DelegateCommand<int?>).
If you're using bool
, you can try to use bool?
okey will try and let you know
Describe the bug Assigning Delegate Command to CheckedChangeCommand Crashing application, "Invalid cast" To Reproduce Steps to reproduce the behavior:
Expected behavior Should raise the DelegateCommand Screenshots If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
Smartphone (please complete the following information):
Additional context Add any other context about the problem here.