spiegelp / MaterialDesignExtensions

Material Design Extensions is based on Material Design in XAML Toolkit to provide additional controls and features for WPF apps
https://spiegelp.github.io/MaterialDesignExtensions/
MIT License
762 stars 122 forks source link

How to properly use the Stepper #4

Closed AmitBhatnagar24 closed 6 years ago

AmitBhatnagar24 commented 6 years ago

How do I know when I have arrived to the next step?

The continue navigation event occurs before the Step is actually selected giving a chance to cancel it.. but how do I know when I have arrived at a step!?

Why no binding to SelectedStep (which gets its value after navigation is complete)

Please help.. I am struggling with this :/

spiegelp commented 6 years ago

Hi, are you looking for an event saying "now I am showing the next step"? Such an event does not exist yet but I will add a StepChanged event to my ToDo list.

The Stepper has a property Controller which exposes ActiveStep. This property always contains the current step, because the UI binds to it. I am thinking of exposing a ActiveStep property directly on the Stepper. Or you might want listen to the PropertyChanged event of the controller and check the arguments for the ActiveStep property name.

AmitBhatnagar24 commented 6 years ago

are you looking for an event saying "now I am showing the next step"?

Not an event, but rather a SelectedStep binding, (like a tab control has SelectedItem), which then my ViewModel would know when we have actually reached that step. I need to do this because when I reach a certain step, I need to perform some calculations. Right now I have to do some ugly code-behind inspection on the prev/next steps to see when I am about to reach the step in question.

I am thinking of exposing a ActiveStep property directly on the Stepper

exactly what I would be looking for.

AmitBhatnagar24 commented 6 years ago

Also, how do I know when the Continue / Finish button is clicked - can I bind to that specific button's Command ?

spiegelp commented 6 years ago

Hi, based on your feedback, I added the following members to the Stepper API:

You can assign your custom command to these new command properties. According well-tried events already exist. The changes will be scheduled for the next release.

AmitBhatnagar24 commented 4 years ago

I'm again adding to this now closed issue because I still feel that I don't know exactly to handle the validation, A new issue is not required.

When I have a 2 Step stepper with BlockNavigationOnValidationErrors set to true. I have derived from Step to allow for validation as per the documents. If I reach step 2 and it fails validation.. why would it prevent me from going back a step? I feel that the BlockNavigationOnValidationErrors should only restrict going to the next step.

How can I accomplish this with the already implemented validation and events/commands already in play?