• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Input.CommandBinding类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中System.Windows.Input.CommandBinding的典型用法代码示例。如果您正苦于以下问题:C# CommandBinding类的具体用法?C# CommandBinding怎么用?C# CommandBinding使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



CommandBinding类属于System.Windows.Input命名空间,在下文中一共展示了CommandBinding类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: DatasetVertexView

        /// <summary>
        /// Initializes a new instance of the <see cref="DatasetVertexView"/> class.
        /// </summary>
        /// <remarks>
        /// This constructor is called internally by the WPF system because this class is part of a template
        /// in the DatasetGraphView. No point in changing this constructor to take external arguments because
        /// it won't work that way.
        /// </remarks>
        internal DatasetVertexView()
        {
            InitializeComponent();

            // Bind the new dataset command
            {
                var cb = new CommandBinding(s_NewDatasetCommand, CommandNewDatasetExecuted, CommandNewDatasetCanExecute);
                CommandBindings.Add(cb);
                addChildDatasetButton.Command = s_NewDatasetCommand;
            }

            // Bind the delete dataset command
            {
                var cb = new CommandBinding(s_RemoveDatasetCommand, CommandDeleteDatasetExecuted, CommandDeleteDatasetCanExecute);
                CommandBindings.Add(cb);
                deleteDatasetButton.Command = s_RemoveDatasetCommand;
            }

            // Bind the activate / deactivate command
            {
                var cb = new CommandBinding(
                    s_ActivateOrDeactivateDatasetCommand,
                    CommandActivateDeactivateDatasetExecuted,
                    CommandActivateDeactivateDatasetCanExecute);
                CommandBindings.Add(cb);
                activateOrDeactivateDatasetButton.Command = s_ActivateOrDeactivateDatasetCommand;
            }

            // Bind the show detail view command
            {
                var cb = new CommandBinding(s_ShowDetailViewCommand, CommandShowDetailViewExecuted, CommandShowDetailViewCanExecute);
                CommandBindings.Add(cb);
                showDetailButton.Command = s_ShowDetailViewCommand;
            }
        }
开发者ID:pvandervelde,项目名称:Apollo,代码行数:43,代码来源:DatasetVertexView.xaml.cs


示例2: MainWindow

    public MainWindow ()
    {
      InitializeComponent ();

      StatusBarText = String.Empty;
      IsHlrOffPushed = false;
      IsHlrOnPushed = true;
      IsZoomWinEnabled = true;

      #region menu operations

      CommandBinding aBind_New = new CommandBinding (IECommands.New);
      aBind_New.Executed += NewCommand_Executed;
      CommandBindings.Add (aBind_New);

      CommandBinding aBind_Close = new CommandBinding (IECommands.Close);
      aBind_Close.Executed += CloseCommand_Executed;
      aBind_Close.CanExecute += CloseCommand_CanExecute;
      CommandBindings.Add (aBind_Close);

      CommandBinding aBind_Quit = new CommandBinding (IECommands.Quit);
      aBind_Quit.Executed += QuitCommand_Executed;
      CommandBindings.Add (aBind_Quit);

      CommandBinding aBind_About = new CommandBinding (IECommands.About);
      aBind_About.Executed += AboutCommand_Executed;
      CommandBindings.Add (aBind_About);

      #endregion
    }
开发者ID:xushengli,项目名称:oce,代码行数:30,代码来源:MainWindow.xaml.cs


示例3: TablesContextMenu

        public TablesContextMenu(DatabaseMenuCommandParameters menuCommandParameters, ExplorerToolWindow parent)
        {
            var dcmd = new DatabaseMenuCommandsHandler(parent);

            var createTableCommandBinding = new CommandBinding(DatabaseMenuCommands.DatabaseCommand,
                            dcmd.BuildTable);
            var createTableMenuItem = new MenuItem
            {
                Header = "Build Table (beta)...",
                Icon = ImageHelper.GetImageFromResource("../resources/AddTable_5632.png"),
                Command = DatabaseMenuCommands.DatabaseCommand,
                CommandParameter = menuCommandParameters
            };
            createTableMenuItem.CommandBindings.Add(createTableCommandBinding);
            Items.Add(createTableMenuItem);
            
            Items.Add(new Separator());

            var refreshCommandBinding = new CommandBinding(DatabaseMenuCommands.DatabaseCommand,
                                                    dcmd.RefreshTables);
            var refreshMenuItem = new MenuItem
            {
                Header = "Refresh",
                Icon = ImageHelper.GetImageFromResource("../resources/refresh.png"),
                Command = DatabaseMenuCommands.DatabaseCommand,
                CommandParameter = menuCommandParameters
            };
            refreshMenuItem.CommandBindings.Add(refreshCommandBinding);
            Items.Add(refreshMenuItem);
        }
开发者ID:inickvel,项目名称:SqlCeToolbox,代码行数:30,代码来源:TablesContextMenu.cs


示例4: createCommandBindings

        private void createCommandBindings()
        {
            CommandBinding bindNew = new CommandBinding();
            CommandBinding bindOpen = new CommandBinding();
            CommandBinding bindSave = new CommandBinding();
            CommandBinding bindExit = new CommandBinding();

            bindNew.Command = ApplicationCommands.New;
            bindNew.Executed += NewGame_Executed;
            bindNew.CanExecute += NewGame_CanExecute;
            CommandBindings.Add(bindNew);

            bindOpen.Command = ApplicationCommands.Open;
            bindOpen.Executed += OpenFile_Executed;
            bindOpen.CanExecute += OpenFile_CanExecute;
            CommandBindings.Add(bindOpen);

            bindSave.Command = ApplicationCommands.Save;
            bindSave.Executed += SaveFile_Executed;
            bindSave.CanExecute += SaveFile_CanExecute;
            CommandBindings.Add(bindSave);

            bindExit.Command = CustomCommands.Exit;
            bindExit.Executed += ExitGame_Executed;
            bindExit.CanExecute += ExitGame_CanExecute;
            CommandBindings.Add(bindExit);
        }
开发者ID:Nefflius,项目名称:Sigge-Projekt,代码行数:27,代码来源:MainWindow.xaml.cs


示例5: page_chat

        public page_chat()
        {
            InitializeComponent();

            RoutedCommand Input_SendMessage = new RoutedCommand();
            RoutedCommand Input_Return = new RoutedCommand();

            KeyBinding Input_SendMessage_Keybinding = new KeyBinding(Input_SendMessage, new KeyGesture(Key.Enter));
            CommandBinding Input_SendMessage_Binding = new CommandBinding(Input_SendMessage, Input_SentMessage_Execute, CmdCanExecute);

            KeyBinding Input_Return_Keybinding = new KeyBinding(Input_Return, new KeyGesture(Key.Enter, ModifierKeys.Control));
            CommandBinding Input_Return_Binding = new CommandBinding(Input_Return, Input_Return_Execute, CmdCanExecute);

            this.rtf_input.InputBindings.Add(Input_SendMessage_Keybinding);
            this.rtf_input.CommandBindings.Add(Input_SendMessage_Binding);

            this.rtf_input.InputBindings.Add(Input_Return_Keybinding);
            this.rtf_input.CommandBindings.Add(Input_Return_Binding);

            CommandBinding pasteCmdBinding = new CommandBinding(ApplicationCommands.Paste, OnPaste, OnCanExecutePaste);
            this.rtf_input.CommandBindings.Add(pasteCmdBinding);

            try
            {
                this.rtf_input.FontSize = Convert.ToDouble(ConfigManager.Instance.GetString("font_size", "12"));
                this.rtf_input.FontFamily = new FontFamily(ConfigManager.Instance.GetString("font", "Segoe WP"));
                this.rtf_input.Foreground = (SolidColorBrush)new BrushConverter().ConvertFromString(ConfigManager.Instance.GetString("font_color", "#000000"));
            }
            catch { }

            this.rtf_input.AddHandler(RichTextBox.DragOverEvent, new DragEventHandler(rtf_DragOver), true);
            this.rtf_input.AddHandler(RichTextBox.DropEvent, new DragEventHandler(rtf_DragDrop), true);
        }
开发者ID:astorks,项目名称:BlazeIM,代码行数:33,代码来源:page_chat.xaml.cs


示例6: MainWindow_Loaded

        private void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            // Creating the main panel
            var mainStackPanel = new StackPanel();
            AddChild(mainStackPanel);

            // Button used to invoke the command
            var commandButton = new Button
            {
                Command = ApplicationCommands.Open,
                Content = "Open (KeyBindings: Ctrl-R, Ctrl-0)"
            };
            mainStackPanel.Children.Add(commandButton);

            // Creating CommandBinding and attaching an Executed and CanExecute handler
            var openCmdBinding = new CommandBinding(
                ApplicationCommands.Open,
                OpenCmdExecuted,
                OpenCmdCanExecute);

            CommandBindings.Add(openCmdBinding);

            // Creating a KeyBinding between the Open command and Ctrl-R
            var openCmdKeyBinding = new KeyBinding(
                ApplicationCommands.Open,
                Key.R,
                ModifierKeys.Control);

            InputBindings.Add(openCmdKeyBinding);
        }
开发者ID:ClemensT,项目名称:WPF-Samples,代码行数:30,代码来源:MainWindow.cs


示例7: InitializeComponent

 public 部門表()
 {
     InitializeComponent();
     CommandBinding binding = new CommandBinding(ApplicationCommands.ContextMenu);
     binding.Executed += ContextMenu_Executed;
     this.CommandBindings.Add(binding);
 }
开发者ID:momo16542,项目名称:DarbWareERP,代码行数:7,代码来源:部門表.xaml.cs


示例8: SetF1CommandBinding

 private void SetF1CommandBinding()
 {
     CommandBinding helpBinding = new CommandBinding(ApplicationCommands.Help);
     helpBinding.CanExecute += CanHelpExecute;
     helpBinding.Executed += HelpExecuted;
     CommandBindings.Add(helpBinding);
 }
开发者ID:newhuaszh,项目名称:WPF,代码行数:7,代码来源:MainWindow.xaml.cs


示例9: MainWindow

		public MainWindow(SessionInfo sessionInfo)
		{
			this.DataContext = sessionInfo;
			
			#region Command bindings
			//New command binding
			CommandBinding newCommandBinding = new CommandBinding(InvoiceManagerCommands.New);
			newCommandBinding.Executed += NewCommand_Executed;
			newCommandBinding.CanExecute += NewCommand_CanExecute;
			CommandBindings.Add(newCommandBinding);
			//Edit command binding
			CommandBinding editCommandBinding = new CommandBinding(InvoiceManagerCommands.Edit);
			editCommandBinding.Executed += EditCommand_Executed;
			editCommandBinding.CanExecute += EditCommand_CanExecute;
			CommandBindings.Add(editCommandBinding);
			//Delete command binding
			CommandBinding deleteCommandBinding = new CommandBinding(InvoiceManagerCommands.Delete);
			deleteCommandBinding.Executed += DeleteCommand_Executed;
			deleteCommandBinding.CanExecute += DeleteCommand_CanExecute;
			CommandBindings.Add(deleteCommandBinding);
			#endregion
			
			InitializeComponent();
			App.Current.MainWindow = this;
		}
开发者ID:revov,项目名称:InvoiceManager,代码行数:25,代码来源:MainWindow.xaml.cs


示例10: MainWindow

        public MainWindow()
        {
            SOTC_BindingErrorTracer.BindingErrorTraceListener.SetTrace();
            this.InitializeComponent();
            /*
            // Insert code required on object creation below this point.
            KeyBinding ib = new KeyBinding(
                GlobalCommands.IncrementSectionNumber, new KeyGesture(Key.U, ModifierKeys.Control));
            this.InputBindings.Add(ib);
            */

            incrementCenterIndexCommand = new RoutedUICommand("+", "IncrementCenterIndexCommand", typeof(MainWindow));
            decrementCenterIndexCommand = new RoutedUICommand("-", "DecrementCenterIndexCommand", typeof(MainWindow));

            CommandBinding cb = new CommandBinding(incrementCenterIndexCommand, OnIncrementSectionNumber);
            this.CommandBindings.Add(cb);

            cb = new CommandBinding(decrementCenterIndexCommand, OnDecrementSectionNumber);
            this.CommandBindings.Add(cb);

            GlobalCommands.IncrementSectionNumber.RegisterCommand(incrementCenterIndexCommand);
            GlobalCommands.IncrementSectionNumber.RegisterCommand(decrementCenterIndexCommand);
            //GlobalCommands.IncrementSectionNumber.Execute(null);

            OnStartup(null);
        }
开发者ID:abordt,项目名称:Viking,代码行数:26,代码来源:MainWindowShell.xaml.cs


示例11: DateInputUC

 public DateInputUC()
 {
     InitializeComponent();
     toggleCalendarAction = new CommandBinding(ToggleCalendarAction, ToggleCalendar);
     CommandBindings.Add(toggleCalendarAction);
     this.AddHandler(Validation.ErrorEvent, new EventHandler<ValidationErrorEventArgs>(ValidationErrorEventHandler));
 }
开发者ID:koder05,项目名称:fogel-ba,代码行数:7,代码来源:DateInputUC.xaml.cs


示例12: MessageWindowElement

        public MessageWindowElement(MessageDailog dm)
            : base()
        {
            var bindinAccept = new CommandBinding(AcceptCommand, OnAccept);
            this.CommandBindings.Add(bindinAccept);

            var bindingCancel = new CommandBinding(CancelCommand, OnCancel);
            this.CommandBindings.Add(bindingCancel);

            if (dm != null)
            {
                Buttons = dm.DialogButton;
                Title = dm.Title;
                Content = dm.Caption;

                if (dm.DialogHeight != 0)
                    this.Height = dm.DialogHeight;
                if (dm.DialogWidth != 0)
                    this.Height = dm.DialogWidth;

                if(dm.IsSizeToContent)
                    this.SizeToContent = SizeToContent.WidthAndHeight;
            }

            CreateContainer();
        }
开发者ID:ruisebastiao,项目名称:WPF-MVVM-With-Entity-Framework,代码行数:26,代码来源:MessageWindowElement.cs


示例13: MainWindow

        // -------------------------------
        // Window operations
        // -------------------------------
        /// <summary>
        /// (Constructor) Initializes main window and sets up shortcut keys.
        /// </summary>
        public MainWindow()
        {
            InitializeComponent();

            // Bind "New" command
            CommandBinding cb = new CommandBinding( commandNew , new_Executed );
            KeyGesture kg = new KeyGesture( Key.N , ModifierKeys.Control );
            InputBinding ib = new InputBinding( commandNew , kg );
            this.CommandBindings.Add( cb );
            this.InputBindings.Add( ib );

            // Bind "Open" command
            cb = new CommandBinding( commandOpen , open_Executed );
            kg = new KeyGesture( Key.O , ModifierKeys.Control );
            ib = new InputBinding( commandOpen , kg );
            this.CommandBindings.Add( cb );
            this.InputBindings.Add( ib );

            // Bind "Save" command
            cb = new CommandBinding( commandSave , save_Executed );
            kg = new KeyGesture( Key.S , ModifierKeys.Control );
            ib = new InputBinding( commandSave , kg );
            this.CommandBindings.Add( cb );
            this.InputBindings.Add( ib );

            // Bind "SaveAll" command
            cb = new CommandBinding( commandSaveAll , saveAll_Executed );
            kg = new KeyGesture( Key.S , ModifierKeys.Alt );
            ib = new InputBinding( commandSaveAll , kg );
            this.CommandBindings.Add( cb );
            this.InputBindings.Add( ib );

            // Bind "Exit" command
            cb = new CommandBinding( commandExit , exit_Executed );
            kg = new KeyGesture( Key.X , ModifierKeys.Control );
            ib = new InputBinding( commandExit , kg );
            this.CommandBindings.Add( cb );
            this.InputBindings.Add( ib );

            // Bind "Delete" command
            cb = new CommandBinding( commandDelete , deleteBlock_Executed );
            kg = new KeyGesture( Key.Delete );
            ib = new InputBinding( commandDelete , kg );
            this.CommandBindings.Add( cb );
            this.InputBindings.Add( ib );

            // Bind "Generate Mesh" command
            cb = new CommandBinding( commandGenerateMesh , generateMesh_Executed );
            kg = new KeyGesture( Key.F7 );
            ib = new InputBinding( commandGenerateMesh , kg );
            this.CommandBindings.Add( cb );
            this.InputBindings.Add( ib );

            // Bind "Run Analysis" command
            cb = new CommandBinding( commandRunAnalysis , run_Executed );
            kg = new KeyGesture( Key.F5 );
            ib = new InputBinding( commandRunAnalysis , kg );
            this.CommandBindings.Add( cb );
            this.InputBindings.Add( ib );
        }
开发者ID:karcheba,项目名称:SlopeFEA,代码行数:66,代码来源:MainWindow.xaml.cs


示例14: OnStartup

        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            var binding = new CommandBinding(Commands.CloseWindow, CloseWindow);
            CommandManager.RegisterClassCommandBinding(typeof(Window), binding);
        }
开发者ID:yu-kopylov,项目名称:cramtool,代码行数:7,代码来源:App.xaml.cs


示例15: MainWindow

        public MainWindow()
            : base(SplashShowing)
        {
            Default = this;

            #region initialize command bindings
            SDWindow.NewCommand.Text = "New Receipt";
            this.NewCommandBinding.Executed += NewReceiptCommand_Executed;
            this.OptionsCommandBinding.Executed += OptionsCommand_Executed;
            ReceiptSingularCommandBinding = new CommandBinding(ReceiptSingularCommand, ReceiptSingularCommand_Executed);
            this.CommandBindings.Add(ReceiptSingularCommandBinding);
            ReceiptTabularCommandBinding = new CommandBinding(ReceiptTabularCommand, ReceiptTabularCommand_Executed);
            this.CommandBindings.Add(ReceiptTabularCommandBinding);
            FeesRegisterCommandBinding = new CommandBinding(FeesRegisterCommand, FeesRegisterCommand_Executed);
            this.CommandBindings.Add(FeesRegisterCommandBinding);
            FeesBalancesCommandBinding = new CommandBinding(FeesBalancesCommand, FeesBalancesCommand_Executed);
            this.CommandBindings.Add(FeesBalancesCommandBinding);
            #endregion
            try
            {
                InitializeComponent();          
            }
            catch (Exception ex)
            {
                Errors.displayError("An error occured starting the application", ErrorCode.MainWindowConstructor, ErrorAction.Exit, ex);
            }
        }
开发者ID:GrayJumba,项目名称:Onion,代码行数:27,代码来源:MainWindow.xaml.cs


示例16: MainWindow

        public MainWindow()
        {
            InitializeComponent();

            FullScreenCommand = new RoutedCommand("FullScreenCommand", typeof(MainWindow));
            FullScreenCommandBinding = new CommandBinding(FullScreenCommand, FullScreenCommandHandler);
        }
开发者ID:xp880906,项目名称:MangaViewer,代码行数:7,代码来源:MainWindow.xaml.cs


示例17: Image

 public Image()
 {
     EditingMode = InkCanvasEditingMode.Select;
     Background = Brushes.Transparent;
     PreviewKeyDown += keyPressed;
     SelectionMoved += elementsMovedOrResized;
     SelectionMoving += elementsMovingOrResizing;
     SelectionChanging += selectingImages;
     SelectionChanged += selectionChanged;
     SelectionResizing += elementsMovingOrResizing;
     SelectionResized += elementsResized;
     Commands.ReceiveImage.RegisterCommand(new DelegateCommand<IEnumerable<TargettedImage>>(ReceiveImages));
     Commands.ReceiveVideo.RegisterCommandToDispatcher<TargettedVideo>(new DelegateCommand<TargettedVideo>(ReceiveVideo));
     Commands.ReceiveDirtyImage.RegisterCommand(new DelegateCommand<TargettedDirtyElement>(ReceiveDirtyImage));
     Commands.ReceiveDirtyVideo.RegisterCommandToDispatcher<TargettedDirtyElement>(new DelegateCommand<TargettedDirtyElement>(ReceiveDirtyVideo));
     Commands.AddImage.RegisterCommandToDispatcher(new DelegateCommand<object>(addImageFromDisk));
     Commands.FileUpload.RegisterCommand(new DelegateCommand<object>(uploadFile));
     Commands.SetPrivacyOfItems.RegisterCommand(new DelegateCommand<string>(changeSelectedItemsPrivacy));
     Commands.ImageDropped.RegisterCommandToDispatcher(new DelegateCommand<ImageDrop>(imagedDropped));
     Commands.ReceiveDirtyLiveWindow.RegisterCommand(new DelegateCommand<TargettedDirtyElement>(ReceiveDirtyLiveWindow));
     Commands.DugPublicSpace.RegisterCommand(new DelegateCommand<LiveWindowSetup>(DugPublicSpace));
     Commands.DeleteSelectedItems.RegisterCommand(new DelegateCommand<object>(deleteSelectedImages));
     Commands.MirrorVideo.RegisterCommand(new DelegateCommand<VideoMirror.VideoMirrorInformation>(mirrorVideo));
     Commands.VideoMirrorRefreshRectangle.RegisterCommand(new DelegateCommand<string>(mirrorVideoRefresh));
     Commands.HideConversationSearchBox.RegisterCommandToDispatcher(new DelegateCommand<object>(hideConversationSearchBox));
     Commands.UpdateConversationDetails.RegisterCommandToDispatcher(new DelegateCommand<object>(updateImagePrivacy));
     var undoHandler = new CommandBinding(ApplicationCommands.Undo, null, justNo);
     this.CommandBindings.Add(undoHandler);
 }
开发者ID:StackableRegiments,项目名称:metl2011,代码行数:29,代码来源:Image.cs


示例18: CageCommands

        static CageCommands()
        {
            CommandFeedClick = new RoutedCommand("CommandFeedClick", typeof(CageCommands));
            CommandHealClick = new RoutedCommand("CommandHealClick", typeof(CageCommands));
            CommandGrowClick = new RoutedCommand("CommandGrowClick", typeof(CageCommands));

            CommandBinding bindingfeed = new CommandBinding();
            bindingfeed.Command = CommandFeedClick;
            bindingfeed.Executed += new ExecutedRoutedEventHandler(CommandFeedClick_Executed);
            bindingfeed.CanExecute += new CanExecuteRoutedEventHandler(CommandFeedClick_CanExecute);

            CommandBinding bindingheal = new CommandBinding();
            bindingheal.Command = CommandHealClick;
            bindingheal.Executed += new ExecutedRoutedEventHandler(CommandHealClick_Executed);
            bindingheal.CanExecute += new CanExecuteRoutedEventHandler(CommandHealClick_CanExecute);

            CommandBinding bindinggrow = new CommandBinding();
            bindinggrow.Command = CommandGrowClick;
            bindinggrow.Executed += new ExecutedRoutedEventHandler(CommandGrowClick_Executed);
            bindinggrow.CanExecute += new CanExecuteRoutedEventHandler(CommandGrowClick_CanExecute);

            CommandManager.RegisterClassCommandBinding(typeof(CageControl), bindingfeed);
            CommandManager.RegisterClassCommandBinding(typeof(CageControl), bindingheal);
            CommandManager.RegisterClassCommandBinding(typeof(CageControl), bindinggrow);
        }
开发者ID:kbo4sho,项目名称:ZooKeeperWpf,代码行数:25,代码来源:CageCommands.cs


示例19: CreateBindings

        //---------------------------------------------------------------------
        /// <summary>
        /// Create standard bindings.
        /// </summary>
        private void CreateBindings()
        {
            var binding = new CommandBinding(ApplicationCommands.New);
            binding.Executed += (s, e) => {mainViewModel.NewCommand(s,e);};
            binding.CanExecute += (s, e) => { mainViewModel.CanExecuteNew(s,e); };
            this.CommandBindings.Add(binding);

            binding = new CommandBinding(ApplicationCommands.Open);
            binding.Executed += (s,e)=> { mainViewModel.OpenCommand(s, e); };
            binding.CanExecute += (s, e) => { mainViewModel.CanExecuteOpen(s,e); };
            this.CommandBindings.Add(binding);

            binding = new CommandBinding(ApplicationCommands.Save);
            binding.Executed += (s, e) => { mainViewModel.SaveCommand(s, e); };
            binding.CanExecute += (s,e) => { mainViewModel.CanExecuteSave(s,e); };

            binding = new CommandBinding(ApplicationCommands.SaveAs);
            binding.Executed += (s, e) => { mainViewModel.SaveAsCommand(s, e); };
            binding.CanExecute += (s, e) => { mainViewModel.CanExecuteSaveAs(s, e); };

            binding = new CommandBinding(ApplicationCommands.Find);
            binding.Executed += (s, e) => { mainViewModel.FindCommand(s, e); };
            binding.CanExecute += (s, e) => { mainViewModel.CanExecuteFind(s, e); };

            binding = new CommandBinding(ApplicationCommands.Delete);
            binding.Executed += (s, e) => { mainViewModel.DeleteCommand(s, e); };
            binding.CanExecute += (s, e) => { mainViewModel.CanExecuteDelete(s, e); };

            binding = new CommandBinding(ApplicationCommands.Help);
            binding.Executed += (s, e) => { mainViewModel.HelpCommand(s, e); };
            binding.CanExecute += (s, e) => { mainViewModel.CanExecuteHelp(s, e); };

            this.CommandBindings.Add(binding);
        }
开发者ID:dk0104,项目名称:Demo,代码行数:38,代码来源:MainWindow.xaml.cs


示例20: ScopesContextMenu

        public ScopesContextMenu(MenuCommandParameters scopeMenuCommandParameters, ExplorerToolWindow parent)
        {
            var dcmd = new ScopesMenuCommandsHandler(parent);

            if (scopeMenuCommandParameters.MenuItemType == MenuType.Manage)

            {

                var dropScopeCommandBinding = new CommandBinding(ScopesMenuCommands.ScopeCommand,
                            dcmd.DropScope);

                var dropScopeMenuItem = new MenuItem
                {
                    Header = "Deprovision Scope...",
                    Icon = ImageHelper.GetImageFromResource("../resources/action_Cancel_16xLG.png"),
                    Command = ScopesMenuCommands.ScopeCommand,
                    CommandParameter = scopeMenuCommandParameters,
                };
                dropScopeMenuItem.CommandBindings.Add(dropScopeCommandBinding);
                Items.Add(dropScopeMenuItem);            
            }
            else
            {
            }
        }
开发者ID:inickvel,项目名称:SqlCeToolbox,代码行数:25,代码来源:ScopesContextMenu.cs



注:本文中的System.Windows.Input.CommandBinding类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Input.Cursor类代码示例发布时间:2022-05-26
下一篇:
C# Input.CanExecuteRoutedEventArgs类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap