using System.Linq; using System.Windows.Controls; using GalaSoft.MvvmLight.Command; using HandyControl.Controls; using HandyControlDemo.Data; using HandyControlDemo.Service; namespace HandyControlDemo.ViewModel; public class StepBarDemoViewModel : DemoViewModelBase { public StepBarDemoViewModel(DataService dataService) => DataList = dataService.GetStepBarDemoDataList(); private int _stepIndex; public int StepIndex { get => _stepIndex; #if NET40 set => Set(nameof(StepIndex), ref _stepIndex, value); #else set => Set(ref _stepIndex, value); #endif } /// /// 下一步 /// public RelayCommand NextCmd => new(Next); /// /// 上一步 /// public RelayCommand PrevCmd => new(Prev); private void Next(Panel panel) { foreach (var stepBar in panel.Children.OfType()) { stepBar.Next(); } } private void Prev(Panel panel) { foreach (var stepBar in panel.Children.OfType()) { stepBar.Prev(); } } }