I have some graphical oriented Windows-Store-App application that logically composed from few layers. Each layer draw its own type of things.
For some reasons , I chose to represent each layer as a WPF canvas. So there are multiple canvases all logically share the same area. non of the canvas is nested in the other. They all on the same level in the “Document Outline” tree , under some cell of a grid object.
I would like input events to be routed only to one specific canvas but i don’t know how to order WPF to do that. All input events always get to the same canvas and that’s not the desired canvas.
I tried to manipulate the ZIndex and the IsHitTestVisible properties of the Canvases to achieve the desired result but it doesn’t seem to change something in the behavior of the app. No matter what i do , the events always get to the same specific Canvas.
I tried to put the desired canvas on-top of all other canvases and i tried to turn off the hit test for all non-desired canvases. None of these action succeeded.
How do I tell the framework to route events to a canvas of my choise?
Even though they are all at the same “level”, each canvas is still drawn on top of the other. The last one to get drawn is the one listed lowest in the XAML view. The one listed lowest is also the first one to have a chance at capturing input. Changing the ZIndex does change the order in which they’re drawn but I don’t believe it changes the order in which input is processed.
You should be able to stop all of the ones you don’t want from processing input by setting their IsHitTestVisible property to false. If that didn’t work, I’m interested in knowing which events are still making it through.