We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Binding events (ProgressCompleted) via prims EventToCommandBehaviour

Good day,

My requirement is to bind the ProgressCompleted event of a SfProgressBar (circular) to a prism delegate command.
So far I have managed to wire the Progress, SegmentCount and Maximum properties to the view model without problems.
Wiring the ProgressCompleted event using prisms EventToCommandBehaviour does not fire a command in the view model.
Catching the event in code behind does work but it is not the desired solution.

xaml:

<progressBar:SfCircularProgressBar.Behaviors>
            <b:EventToCommandBehavior
                EventName="ProgressCompleted"
                Command="ProgressCompletedEvent"
                CommandParameter="Complete"/>
        </progressBar:SfCircularProgressBar.Behaviors>

Kindly provide feedback wrt what the correct approach would be.

Warm regards

3 Replies

SS Sathish Sivakumar Syncfusion Team May 6, 2019 12:34 PM UTC

Hi Ian, 
 
Greetings from Syncfusion. 
 
We have prepared a simple sample using prism framework to convert the event to command using EventToCommandBehaviour. We can see the command is triggered as expected for the ProgressCompleted event in SfCircularProgressBar. Please refer the sample in the below link. 
 
 
Kindly ensure that the command associated to ProgressCompleted event is properly bonded.  
 
Please modify the above sample if you are still facing the same issue. 
 
Regards, 
Sathish 



IA Ian May 8, 2019 06:08 AM UTC

Good day Sathish,

Thank you for the response.
The sampled worked and I modified it to use Prism's DelegateCommand - worked as well.
The issue reoccurs as soon as the ViewModels constructor is not parameter-less with the BindingContext section in the xaml View file giving an error:

"Type xyzPageViewModel is not usable as an object element because it is not public or does not define a public parameterless  constructor or type converter"

Unfortunately, I cannot use a parameter-less constructor (I am using Prism's NavigationService) in my solution.

I have no idea how to fix this currently and will prepare a sample when time permits - (maybe I should look at a type converter?).

For now I will have to work around the issue of not being able to detect the event in the ViewModel.

Regards


DB Dilli Babu Nandha Gopal Syncfusion Team May 10, 2019 10:59 AM UTC

Hi Ian, 

Thank you for your update. 

We request you to share us your sample in which the mentioned error was occurred and unable to use parameter less constructor so that we can modified the sample as per your requirement. 

Regards, 
Dilli babu. 


Loader.
Live Chat Icon For mobile
Up arrow icon