I creating a custonmized box class (inherits from ComboBox). I don’t want the text box to react to right mouse clicks. I can get rid of the context menu by setting this to null in ApplyTemplate, but right mouse clicks move the cursor. I tried hooking up PreviewMouseRightButtonDown in ApplyTemplate and setting Handled to True, but the event still gets through which is strange as it seems to work for the left click.
I creating a custonmized box class (inherits from ComboBox). I don’t want the text
Share
The cursor actually moves when the mouse button is released, so you want mark the MouseRightButtonUp event as handled. You could override OnMouseRightButtonUp:
Or you could attach a class handler to the MouseRightButtonUp event to mark it as handled:
That will also prevent the context menu from being created without you having to set it to null explicitly.