1

I am building a wpf app for a touch screen for windows 8 and I need to disable touch&hold (the equivalent of right click). I have read at the remarks on this link http://msdn.microsoft.com/en-us/library/system.windows.uielement.previewtouchdown.aspx that pressing a finger on the screen and holding it without moving it causes the press and hold behavior of a Stylus. Unfortunately, right click was not disabled by setting Stylus.IsPressAndHoldEnabled="False" in the XAML.

Could you please help me disable it? Thank you in advance :)

AlexandruMN
  • 63
  • 2
  • 8
  • http://stackoverflow.com/questions/5962108/disable-a-right-click-press-and-hold-in-wpf-application – Ofiris May 30 '13 at 19:55

1 Answers1

0

You can write event handler for OnPreviewMouseRightButtonDown event and set the value of isHandled to true.

Nishant
  • 443
  • 3
  • 9
  • thank you for your reply! I have written event handlers for PreviewMouseRightButtonDown and Up and set Handled to true but is not working. I forgot to mention that on the main window I have a webBrowser. – AlexandruMN May 31 '13 at 12:17
  • Do you want to disable the right click inside WebBrowser? I am not aware of any easy way to do it. WebBrowser is a winform control wrapped for WPF. Moreover, the right click has to be disabled in the html code for the web page which is rendered inside WebBrowser. There is way you can inject and invoke a javascript code into the web page displayed. You may want to explore it further to disable right click using javascript. – Nishant May 31 '13 at 14:41
  • Thank you! I was just loading a mockup so I wanted to know if it could be done from c# – AlexandruMN Jun 01 '13 at 07:28