我需要以下指导。操纵事件应该在可视树上进行路由直到处理?
我有以下内容:
Canvas canvas = new Canvas();
canvas.Width = 1920;
canvas.Height = 1200;
canvas.IsManipulationEnabled = true;
canvas.AddHandler(ManipulationStartingEvent, new EventHandler<ManipulationStartingEventArgs>(CanvasManipulationStarting), true);
ScatterViewItem svi = new ScatterViewItem();
svi.AddHandler(ManipulationStartingEvent, new EventHandler<ManipulationStartingEventArgs>(SVIManipulationStarting), true);
svi.Content = canvas;
public void SVIManipulationStarting(object sender, ManipulationStartingEventArgs e)
{
//e.Handled = true; //This fires if uncommented
}
public void CanvasManipulationStarting(object sender, ManipulationStartingEventArgs e)
{
e.Handled = true; //This never fires regardless :( sob
}
如果我点击画布,SVIManipulationStarting会触发,但如果它被取消注释,CanVasManipulationStarting永远不会触发?
答案 0 :(得分:0)
如果我理解正确的话,Canvas
如果点击它就不会引发操作事件,而ScatterViewItem
(Canvas
的容器是Canvas
的容器。引发此事件,特别是如果您在Canvas
操作事件处理程序中处理它。
Background
没有IsHitTestVisible
颜色,则在将true
设置为Canvas
ScatterViewItem
而不将其添加到Canvas
(但是添加到其他现有容器中)。只是为了检查您在其他情况下的{{1}}行为。