• CommandBinding用法


    .cs文件中用法 

    private void BindCommands()
            {
                //[OK]
                CommandBinding cb = new CommandBinding(Commands.OK, OnOK);
                this.CommandBindings.Add(cb);
                this.OkButton.Command = Commands.OK;
                //[CANCEL]
                cb = new CommandBinding(Commands.Cancel, OnCancel);
                this.CommandBindings.Add(cb);
                this.CancelButton.Command = Commands.Cancel;          
            }

    然后在构造函数中调用即可。 

    .xmal中用法

    先在.cs文件中定义:        public static RoutedCommand CloseCommand = new RoutedCommand();

      <Window.CommandBindings>
        <CommandBinding Command="path:fileName.CloseCommand" Executed="Click_OK"/>
      </Window.CommandBindings>
      <Window.InputBindings>
        <KeyBinding Command="path:fileName.CloseCommand" Gesture="Escape"/>
        <KeyBinding Command="path:fileName.CloseCommand" Gesture="Enter"/>
      </Window.InputBindings>

  • 相关阅读:
    javascript零散要点收集
    javascript闭包,arguments和prototype
    javascript面向对象规则汇总以及json
    递归转非递归的编程思想
    汇编要点汇总
    队列相关算法
    深度优先遍历算法
    C++面向对象要点
    堆排序
    快速排序算法
  • 原文地址:https://www.cnblogs.com/sizzle/p/891915.html
Copyright © 2020-2023  润新知