Click here to Skip to main content
15,939,793 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have a problem in wpf application..i created a window and i am calling a usercontrol into that window. when i mouse click on the usercontrol place in window the usercontrol is selecting. How to prevent this selection.

For example: how we select a text in page or notepad. Thats how usercontrol is selecting in window.
Updated 25-Apr-13 0:51am
[no name] 25-Apr-13 7:22am    
Based on the description of your "problem", the obvious thing to do is to stop clicking on your user control.
KishoreUHG 25-Apr-13 7:31am    
yes. By clicking on that its selecting with blue color..
[no name] 25-Apr-13 8:26am    
So stop clicking on it.
KishoreUHG 25-Apr-13 8:27am    
I will not click on it but QA's or client may.. thats not correct answer

1 solution

You need to set the IsHitTestVisible property to false, on the user control.

Note: If you have any other controls, on the user control that require hit testing/click events (i.e. Button), then you will need to set the IsHitTestVisible property to false on the controls within the user control style, that you don't want selection to occur on, instead of the user control itself.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900