EventToCommandBehavior for 3rd party Control Error #3289
Replies: 2 comments
-
Have you tried adding a Catch on the Command? var myCommand = new DelegateCommand(() =>
{
// Do something
}).Catch(ex =>
{
// Handle the exception...
}); If you know what the actual exception is you can specify that for the Command. I'm not sure what your PrismDefaultEventArgsConverter is, but it looks like this is the real error:
From this my guess is that your converter is expecting EventArgs which wouldn't have the NewTextValue path while the NumericEntryValueChangedEventArgs would. |
Beta Was this translation helpful? Give feedback.
-
Not sure why the converter is even there. Removing it doesn't fix the issue however. I tried adding the catch on the DelegateCommand however it never even gets to the constructor. The error is thrown when trying to Show the Dialog (.ShowDialogAsync). Interestingly if I swap out to the MAUI Community Toolkit's EventToCommandBehavior and specify the x:TypeArguments to be the NumericEntryValueChangedEventArgs it works ok...
If you want to look into this further to help Prism I can put together a demo but I have working workarounds currently so I'm happy (enough). Cheers again. |
Beta Was this translation helpful? Give feedback.
-
I am using a Syncfusion Numeric Entry control for .net MAUI and trying to get the EventToCommandBehavior to invoke the Delegate Command in the ViewModel.
However when I add the EventToCommandBehavior to the control I get an exception when navigating to the view (or opening the dialog).
System.ArgumentException: Expression of type 'Syncfusion.Maui.Inputs.NumericEntryValueChangedEventArgs' cannot be used for parameter of type 'System.EventArgs' of method 'Void Invoke(System.Object, System.EventArgs)' (Parameter 'arg1')
The code block for the control in question is,
I've tried with and without the EventArgsParameterPath and converter with no love...
Doing the same thing with a basic Entry Control works fine. (ignore the event name differences this was just for testing)
I assume the args for the SfNumericEntry ValueChanged event (NumericEntryValueChangedEventArgs) are not inherited from the System.EventArgs so Prism is freaking out... Just wondering what, if anything I can do about it?
I don't recall having this issue in Xamarin Forms so just checking if something has changed that I've missed.
Cheers
-- Full Stack Trace Below --
Beta Was this translation helpful? Give feedback.
All reactions