Exemplo n.º 1
0
        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")
            }));
        }
Exemplo n.º 2
0
        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;
            }
        }
Exemplo n.º 3
0
 public ParentBarButtonInfo(MVVMBarViewModel viewModel, MyParentCommandType type)
     : base(() => Execute(type, viewModel))
 {
 }