Reputation: 123
I am working on desktop application i got suggestion to use wpf instead winforms. I want to go to another form/window when i click my label but i cant find click event for label and textblock? also can anyone tell me what is left mouse up event used for?
Upvotes: 12
Views: 27504
Reputation: 169380
also can anyone tell me what is left mouse up event used for?
It can for example be used to handle the click of a TextBlock
like you want:
<TextBlock Text="..." MouseLeftButtonUp="TextBlock_MouseLeftButtonUp" />
This event occurs when the left mouse button is released while the mouse pointer is over this element as stated in the documentation: https://msdn.microsoft.com/en-us/library/system.windows.uielement.mouseleftbuttonup(v=vs.110).aspx
You could also handle the MouseLeftButtonDown
event: https://msdn.microsoft.com/en-us/library/system.windows.uielement.mouseleftbuttondown(v=vs.110).aspx
Upvotes: 23
Reputation: 1918
You can use PreviewMouseDown Event on TextBlock.
<TextBlock x:Name="myTextBlock" PreviewMouseDown="TextBlock_Clicked"/>
Upvotes: 1