MS Surface Tag Visualizer steals contact events

2019-08-04 13:25发布

I'm struggling with the TagVisualizer control on an MS Surface project. In theory the control seems great, allowing you to respond to input from real world physical objects

The problem is that the control will cover the entire screen (since I want to capture tags on the entire screen) and as such, no other controls in my app will receive the touch events. (Unless, they are direct ascendants in the visual tree).

In my app, I want to have a "layer" type of a approach, where each layer can respond to (contact) input:

Window
  `- Grid
      `- LayersPanel
          `- TagVisualizer
          `- Layer 1
          `- Layer 2
          `- Layer 3
          `- Layer 4    

Now it doesn't matter where I put the tag visualizer, it's always going to steal contact events from all or some of the other layers. (due to the nature of RoutedEvents)

To me, it seems like the control is completely useless in practice as it will always interfere with your application's other controls. What am I missing here?

So my questions are: Any suggestions on how to work around this? Has anyone used TagVisualizers in a similar scenario? If so, how did you solve this?

By the way, the layers all work fine, since they will only steal events that are directly on top of their sub elements (the rest of the layer is invisible to hit testing)

1条回答
做个烂人
2楼-- · 2019-08-04 14:16

When using TagVisualizer, the trick is that you have to put your whole app inside of it. For example:

<s:TagVisualizer>
  <s:TagVisualizer.Definitions>
    <s:ByteTagVisualizationDefinition Value="00" />
  </s:TagVisualizer.Definitions>
  <s:ScatterView>
    <s:ScatterViewItem />
    <s:ScatterViewItem />
    <s:ScatterViewItem />
    <s:ScatterViewItem />
  </s:ScatterView>
</s:TagVisualizer>
查看更多
登录 后发表回答