/// <summary> /// Refresh the wizard steps. /// </summary> public void RefreshSteps() { if (Steps != null) { for (int i = 0; i < Steps.Count; i++) { var step = Steps[i]; if (step != null) { step.SetWizard(this); if (step.Visibility == Visibility.Visible) { step.SetIndex(i); step.Selected = OnStepSelected; } } } FirstStep?.ClearFisrtAndLast(); LastStep?.ClearFisrtAndLast(); FirstStep = Steps.FirstOrDefault(e => e.Visibility == Visibility.Visible); LastStep = Steps.LastOrDefault(e => e.Visibility == Visibility.Visible); if (Steps.Count(e => e.Visibility == Visibility.Visible) > 1) { FirstStep?.SetFirst(); LastStep?.SetLast(); } else { FirstStep?.SetOnlyStep(); } CurrentStep = FirstStep; } }