OkCommand not working

Hello All,

I have a timepicker that I am using, I have a CancelCommand and an OkCommand in my ViewMod.  But no matter which is pressed the CancelCommand is being excecuted.  

Any help / suggestions are appreciated.

Thanks,

Mike 


3 Replies

SS Suganya Sethuraman Syncfusion Team February 1, 2022 08:55 AM UTC

Hi Mike,

Since we are unable to reproduce the reported issue, we would like you to check the issue with the attached sample and let us know if it is reproduced. Else, please revert to us by modifying the sample based on your application and provide the replication procedure or the sample. It will be helpful for us to provide a better solution at the earliest.

Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/TimePickerCommand-1683454486

Regards,
Suganya Sethuraman.
 



MP Mike Phillips February 1, 2022 01:15 PM UTC

Suganya,


Thank you for the example!  Your example worked for me so I modified it to use ReactiveUI ReactiveCommands like how my commands are and the OkCommand no longer worked.  


1st change - OK did not function, Cancel did

public ICommand ButtonCommand => ReactiveCommand.Create(OkButtonPressed);

public ICommand CancelCommand => ReactiveCommand.Create<object>(CancelButtonPressed);


2nd change - Both commands worked

public ICommand ButtonCommand => ReactiveCommand.Create<object>(OkButtonPressed);

public ICommand CancelCommand => ReactiveCommand.Create<object>(CancelButtonPressed);


I will do some more digging to see why I needed to add the object parameter.  It's strange because I have had this code working in the past without the object parameter.  So an update along the way broke it...


Thank 



SS Suganya Sethuraman Syncfusion Team February 2, 2022 11:38 AM UTC

Hi Mike,

Since the beginning of the implementation, we have handled CommandParamter as SelectionChangedEventArgs in both OkCommand and CancelCommand. We have not made any changes to that. If you want to use ReactiveCommand in OkCommand and CancelCommand, you must pass the object.

Code snippet:
 
public ICommand ButtonCommand => ReactiveCommand.Create<object>(OkButtonPressed); 
 
public ICommand CancelCommand => ReactiveCommand.Create<object>(CancelButtonPressed); 


Please check and let us know if you have any concerns.

Regards,
Suganya Sethuraman.
 


Loader.
Up arrow icon