Question

I have a window with an embedded Chromium view, and a button bound to the BrowseBack command. The button works, but if I press the backspace key, it triggers the BrowseBack command instead of letting the user delete text in a text box inside the Chromium WebView.

I thought if I could find the InputBindingCollection where the command was bound, I could remove it, but I don't know where the default binding is registered. I have no idea whether this behavior is a bug in Chromium or expected behavior, or if there is a way to let backspace have the normal effect when a text field is focused.

Was it helpful?

Solution

I believe you can use ApplicationCommands.NotACommand to disable that input binding. This works for the standard WPF controls, and should work for that control as well. For example:

<WebView>
    <WebView.InputBindings>
        <KeyBinding Key="Backspace" Command="ApplicationCommands.NotACommand"/>
    </WebView.InputBindings>
</WebView>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top