title | page_title | description | slug | tags | published | position |
---|---|---|---|---|---|---|
Keyboard Support |
Keyboard Support |
Check our "Keyboard Support" documentation article for the RadPdfViewer {{ site.framework_name }} control. |
radpdfviewer-keyboard-support |
keyboard,support |
true |
10 |
RadPdfViewer supports KeyBindings - it has a number of predefined common key-bindings, but you can also customize them by disabling the default ones and defining new ones.
The key-bindings supported by the control are:
Hotkey | Action (Command) | Parameter |
---|---|---|
Ctrl+C | Copy | |
Ctrl+A | SelectAll | |
Left Arrow | MoveCaret | CaretMovementType.MoveToPreviousCharacter |
Right Arrow | MoveCaret | CaretMovementType.MoveToNextCharacter |
Ctrl+Left Arrow |
MoveCaret |
CaretMovementType.MoveToPreviousWord |
Ctrl+Right Arrow |
MoveCaret |
CaretMovementType.MoveToNextWord |
Upper Arrow |
MoveCaret |
CaretMovementType.MoveLineUp |
Down Arrow |
MoveCaret | CaretMovementType.MoveLineDown |
Home |
MoveCaret |
CaretMovementType.MoveToLineStart |
End |
MoveCaret |
CaretMovementType.MoveToLineEnd |
Ctrl+Home |
MoveCaret |
CaretMovementType.MoveToStartOfDocument |
Ctrl+End |
MoveCaret |
CaretMovementType.MoveToEndOfDocument |
The key bindings of the viewer can be retrieved using the KeyBindings property. After that, you can proceed to modify the collection using the public API of the class:
{{region radpdfviewer-keyboard-support_1}} public void Clear() //Clears the collection public void SetInputBindings(InputBindingCollection inputBindings) //Clears the current KeyBindings and sets the new ones.
public void Add(InputBinding inputBinding)
public void AddRange(IEnumerable<InputBinding> inputBindings)
public void RegisterCommand(ICommand command, Key key, ModifierKeys modifierKeys = ModifierKeys.None, object commandParameter = null)
{{endregion}}
Here is an example that shows how the default input bindings can be cleared and two ways of registering new key bindings:
{{region radpdfviewer-keyboard-support_0}} this.pdfViewer.Clear(); this.pdfViewer.KeyBindings.Add(new KeyBinding(this.pdfViewer.Commands.PageUpCommand, new KeyGesture(Key.PageUp))); this.pdfViewer.KeyBindings.RegisterCommandDescriptor(this.pdfViewer.CommandDescriptors.PageDownCommandDescriptor, Key.PageDown); {{endregion}}