static void Execute(MyParentCommandType type, MVVMBarViewModel viewModel) { switch (type) { case MyParentCommandType.CommandCreation: viewModel.Bars[0].Commands.Add(CreateNewBarButtonInfo(viewModel)); break; case MyParentCommandType.BarCreation: BarViewModel model = ViewModelSource.Create(() => new BarViewModel() { Name = "New Bar" }); model.Commands.Add(CreateNewBarButtonInfo(viewModel)); viewModel.Bars.Add(model); break; } }
public MyParentCommand(MVVMRibbonViewModel viewModel, MyParentCommandType type) { this.viewModel = viewModel; this.type = type; }
public ParentBarButtonInfo(MVVMBarViewModel viewModel, MyParentCommandType type) : base(() => Execute(type, viewModel)) { }