代码之家  ›  专栏  ›  技术社区  ›  Brennan Vincent

将mouseLeftButtonDown传递给Silverlight中Zindex较低的控件

  •  2
  • Brennan Vincent  · 技术社区  · 14 年前

    我有一个Silverlight 3应用程序,其网格布局根目录的内部如下所示:

    <!-- other controls go here -->
    <Canvas Canvas.ZIndex="10000" MouseMove="MoveCursor" Background="#00000000">
      <Image Source="badcursor.jpg" x:Name="CustomCursor"/>
    </Canvas>
    <!-- some more other controls -->
    

    画布旨在覆盖页面上的所有其他内容,但不可见,以便我使用自定义光标badcorsor.jpg。但是,现在当我单击页面上的任意位置时,mouseLeftButtonDown不会在任何其他控件上被激发,我假设是因为画布正在处理它,而不是因为它的z索引高于任何其他控件(这是显示光标所必需的!)

    Does anyone know of a way to get the controls underneath the canvas to see the event, or have a better way of doing what I'm trying to do?

    1 回复  |  直到 14 年前
        1
  •  2
  •   Brennan Vincent    14 年前

    通过在画布和图像上将ishittestVisible设置为false来解决此问题。