I am trying to stop F5
on my WebBrowser control
in WPF
. I have came across this solution. but i am unable to find WebBrowserShortcutsEnabled
for WebBrowser control
. Is there an equivalent for WebBrowserShortcutsEnabled
or am i missing something.
Asked
Active
Viewed 720 times
1 Answers
2
You may prevent keyboard events from reaching the WebBrowser
control in WPF by handling its PreviewKeyDown
event. This will allow you to override the behavior, as well as do nothing for specific key strokes. Handling the Backspace key might be harder, since it might prevent user input in text boxes.
void Browser_OnPreviewKeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.F5)
{
e.Handled = true;
}
}
Xaml:
<WebBrowser PreviewKeyDown="Browser_OnPreviewKeyDown"></WebBrowser>

Bas
- 26,772
- 8
- 53
- 86
-
Hope i need an Attached Property :) – Abin Dec 01 '15 at 20:00