using System; using System.Collections.Generic; using System.Linq; using System.Windows.Controls; using GalaSoft.MvvmLight; using GalaSoft.MvvmLight.CommandWpf; using HandyControl.Controls; using HandyControlDemo.Data; using HandyControlDemo.Service; namespace HandyControlDemo.ViewModel { public class StepBarDemoViewModel : ViewModelBase { /// /// 数据列表 /// private List _dataList; /// /// 数据列表 /// public List DataList { get => _dataList; set => Set(ref _dataList, value); } public StepBarDemoViewModel(DataService dataService) { DataList = dataService.GetStepBarDemoDataList(); } /// /// 下一步 /// public RelayCommand NextCmd => new Lazy>(() => new RelayCommand(Next)).Value; /// /// 上一步 /// public RelayCommand PrevCmd => new Lazy>(() => new RelayCommand(Prev)).Value; 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(); } } } }