Reputation: 11
I am having a tricky problem, I need to do some action when a user is making a right-click on a checkbox, but this checkbox can be disabled (IsEnabled="False"
) for business logic reason.
The problem is that even the previewMousDown
event is not raised when the CheckBox
is disabled.
Any idea how to solve this problem?
Upvotes: 1
Views: 1683
Reputation: 11926
surround your CheckBox with a ContentControl and handle that event on the ContentControl
Upvotes: 3
Reputation: 629
You could have a MouseDown eventhandler on a control higher up in the VisualTree and use HitTest to figuer out if your checkbox would be "RightClicked"
http://msdn.microsoft.com/en-us/library/ms752097.aspx
Upvotes: 4