static BarButtonInfo CreateNewBarButtonInfo(MVVMBarViewModel viewModel)
        {
            string caption = "New Command";
            Action action  = () => viewModel.MessageBoxService.Show(String.Format("Command \"{0}\" executed", caption));

            return(ViewModelSource.Create(() => new BarButtonInfo(action)
            {
                Caption = caption,
                LargeGlyph = DXImageHelper.GetDXImage("Wizard_32x32.png"),
                SmallGlyph = DXImageHelper.GetDXImage("Wizard_16x16.png")
            }));
        }
        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 ParentBarButtonInfo(MVVMBarViewModel viewModel, MyParentCommandType type)
     : base(() => Execute(type, viewModel))
 {
 }