user1836155
user1836155

Reputation: 918

WPF PreviewMouseDown event not firing for elements in Grid if clicking at the edge of row

I have a Grid with rows of TextBlocks each assigned a PreviewMouseDown event handler. This event does fire when I click on the text of the TextBlocks but if I click on the edge, the event does not fire even though the canvas updates.

I've tried setting a transparent background for both the TextBlock and the Grid but that didn't help.

Any advice?

Thanks.

Upvotes: 1

Views: 1289

Answers (1)

user1836155
user1836155

Reputation: 918

I fixed this issue by going to GridView and using the SelectionChanged handler (still doesn't catch the case if you are not clicking on a different row but that seems sufficient).

Upvotes: 1

Related Questions