I have a textblock beneath an InkCanvas. (The textblock is not a child of the InkCanvas).
The textblock is created with Inline elements that have attached events like:
run.MouseEnter += inline_MouseEnter;
run.MouseLeave += inline_MouseLeave;
run.MouseDown += inline_MouseDown;
The problem is the InkCanvas eats the mouse/pen events (as strokes) before they can reach the InLine elements.
Without using HitTesting, is there a good way for mouse/pen events to be seen and managed by the inlines of the textblock?
Thank you for considering this problem.
If I understood correctly, the text box is covered completely by the canvas and you want the mouse events to be still handled by the canvas so you can still draw on it (that's why you can't use IsHitTestVisible=False
) but to also be passed to the text box. If this is true, the easiest thing to do would be to subscribe your text box event handlers to canvas events, i.e:
canvas.MouseEnter += inline_MouseEnter;
Keep in mind the sender will not be the text box, obviously...