示例#1
0
        void InitializeClipboardBar()
        {
            BarViewModel clipboardBar = ViewModelSource.Create(() => new BarViewModel()
            {
                Name = "Clipboard"
            });

            Bars.Add(clipboardBar);
            var cutCommand = ViewModelSource.Create(() => new BarButtonInfo(cutCommandExecuteFunc)
            {
                Caption = "Cut", LargeGlyph = DXImageHelper.GetDXImage("Cut_32x32.png"), SmallGlyph = DXImageHelper.GetDXImage("Cut_16x16.png")
            });
            var copyCommand = ViewModelSource.Create(() => new BarButtonInfo(copyCommandExecuteFunc)
            {
                Caption = "Copy", LargeGlyph = DXImageHelper.GetDXImage("Copy_32x32.png"), SmallGlyph = DXImageHelper.GetDXImage("Copy_16x16.png")
            });
            var pasteCommand = ViewModelSource.Create(() => new BarButtonInfo(pasteCommandExecuteFunc)
            {
                Caption = "Paste", LargeGlyph = DXImageHelper.GetDXImage("Paste_32x32.png"), SmallGlyph = DXImageHelper.GetDXImage("Paste_16x16.png")
            });
            var selectCommand = ViewModelSource.Create(() => new BarButtonInfo(selectAllCommandExecuteFunc)
            {
                Caption = "Select All", LargeGlyph = DXImageHelper.GetDXImage("SelectAll_32x32.png"), SmallGlyph = DXImageHelper.GetDXImage("SelectAll_16x16.png")
            });
            var blankCommand = ViewModelSource.Create(() => new BarButtonInfo(blankCommandExecuteFunc)
            {
                Caption = "Clear Page", LargeGlyph = DXImageHelper.GetDXImage("New_32x32.png"), SmallGlyph = DXImageHelper.GetDXImage("New_16x16.png")
            });

            clipboardBar.Commands.Add(cutCommand);
            clipboardBar.Commands.Add(copyCommand);
            clipboardBar.Commands.Add(pasteCommand);
            clipboardBar.Commands.Add(selectCommand);
            clipboardBar.Commands.Add(blankCommand);
        }
示例#2
0
        void InitializeAdditionBar()
        {
            BarViewModel addingBar = ViewModelSource.Create(() => new BarViewModel()
            {
                Name = "Addition"
            });

            Bars.Add(addingBar);
            var addGroupCommand = ViewModelSource.Create(() => new GroupBarButtonInfo()
            {
                Caption = "Add", LargeGlyph = DXImageHelper.GetDXImage("Add_32x32.png"), SmallGlyph = DXImageHelper.GetDXImage("Add_16x16.png")
            });
            var parentCommand = ViewModelSource.Create(() => new ParentBarButtonInfo(this, MyParentCommandType.CommandCreation)
            {
                Caption = "Add Command", LargeGlyph = DXImageHelper.GetDXImage("Add_32x32.png"), SmallGlyph = DXImageHelper.GetDXImage("Add_16x16.png")
            });
            var parentBar = ViewModelSource.Create(() => new ParentBarButtonInfo(this, MyParentCommandType.BarCreation)
            {
                Caption = "Add Bar", LargeGlyph = DXImageHelper.GetDXImage("Add_32x32.png"), SmallGlyph = DXImageHelper.GetDXImage("Add_16x16.png")
            });

            addGroupCommand.Commands.Add(parentCommand);
            addGroupCommand.Commands.Add(parentBar);
            addingBar.Commands.Add(addGroupCommand);
            addingBar.Commands.Add(parentCommand);
            addingBar.Commands.Add(parentBar);
        }
        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")
            }));
        }
 public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
 {
     return(DXImageHelper.GetDXImage((string)value));
 }