public MainPage()
        {
            InitializeComponent();

            OpenHelpPageCommand = new DelegateCommand(ExecuteOpenHelpPage);
            this.DataContext = OpenHelpPageCommand;
            InputBindingCollection inputBindCollection = new InputBindingCollection();
            inputBindCollection.Add(new KeyBinding(this.OpenHelpPageCommand, new KeyGesture(Key.F1)));
            CommandManager.SetInputBindings(this, inputBindCollection);
        }
Exemple #2
0
        public void BindCommands(CommandBindingCollection bindings, InputBindingCollection inputBindings)
        {
            //Switch View
            bindings.Add(new CommandBinding(Commands.SwitchView,
                                        delegate(object target, ExecutedRoutedEventArgs args)
                                        {
                                            OnSwitchView();
                                            args.Handled = true;
                                        }));
            inputBindings.Add(new InputBinding(Commands.SwitchView, new KeyGesture(Key.Enter)));
            
            //Display Next
            bindings.Add(new CommandBinding(Commands.DisplayNext,
                                        delegate(object target, ExecutedRoutedEventArgs args)
                                        {
                                            OnDisplayNext();
                                            args.Handled = true;
                                        }));
            inputBindings.Add(new InputBinding(Commands.DisplayNext, new KeyGesture(Key.PageDown)));

            //Display Prev
            bindings.Add(new CommandBinding(Commands.DisplayPrev,
                                        delegate(object target, ExecutedRoutedEventArgs args)
                                        {
                                            OnDisplayPrev();
                                            args.Handled = true;
                                        }));
            inputBindings.Add(new InputBinding(Commands.DisplayPrev, new KeyGesture(Key.PageUp)));

            //Display First
            bindings.Add(new CommandBinding(Commands.DisplayFirst,
                                        delegate(object target, ExecutedRoutedEventArgs args)
                                        {
                                            OnDisplayFirst();
                                            args.Handled = true;
                                        }));
            inputBindings.Add(new InputBinding(Commands.DisplayFirst, new KeyGesture(Key.Home)));

            //Display Last
            bindings.Add(new CommandBinding(Commands.DisplayLast,
                                        delegate(object target, ExecutedRoutedEventArgs args)
                                        {
                                            OnDisplayLast();
                                            args.Handled = true;
                                        }));
            inputBindings.Add(new InputBinding(Commands.DisplayLast, new KeyGesture(Key.End)));

            //Zoom To Fit
            bindings.Add(new CommandBinding(Commands.ZoomToFit,
                                        delegate(object target, ExecutedRoutedEventArgs args)
                                        {
                                            OnZoomToFit();
                                            args.Handled = true;
                                        }));
            inputBindings.Add(new InputBinding(Commands.ZoomToFit, new KeyGesture(Key.Insert)));
        }
Exemple #3
0
 public static void SetInputBinding(InputBindingCollection inputCollection, ICommand command, InputGesture gesture)
 {
     var binding = new InputBinding(command, gesture);
     inputCollection.Remove(binding);
     inputCollection.Add(binding);
 }
        /// <summary>
        /// コマンドを操作にバインディングします。
        /// </summary>
        public static void Binding(InputBindingCollection inputs)
        {
            inputs.Add(
                new KeyBinding(MoveUndo,
                    new KeyGesture(Key.Left)));
            inputs.Add(
                new KeyBinding(MoveRedo,
                    new KeyGesture(Key.Right)));

            inputs.Add(
                new KeyBinding(LoadKifFile,
                    new KeyGesture(Key.O, ModifierKeys.Control)));
            inputs.Add(
                new KeyBinding(SaveKifFile,
                    new KeyGesture(Key.A, ModifierKeys.Control)));

            inputs.Add(
                new KeyBinding(PasteKifFile,
                    new KeyGesture(Key.V, ModifierKeys.Control)));
            inputs.Add(
                new KeyBinding(CopyKifFile,
                    new KeyGesture(Key.C, ModifierKeys.Control)));
        }