TagVisualizer - when active - blocks Textbox touch

2019-09-08 02:08发布

问题:

I have a TagVisualizer covering the entire screen. Nested inside is a fullscreen ScatterView. Inside one of my ScatterViewItems is UserControl which lists n amount of SurfaceTextBoxs. The UserControl and ScatterViewItems are always visible.

E.g.

<TagVisualizer Panel.ZIndex="1">
<TagVisualizer.Definitions>
...
<TagVisualizer.Definitions>

<ScatterView Panel.ZIndex="2">
<ScatterViewItem />
<ScatterViewItem />
<ScatterViewItem >
<UserControl />
</ScatterViewItem>
...
</ScatterView>
</TagVisualizer>

The problem I have is when there is no tags being recognized on the table the Touch input works and the Keyboard pops up and functions correctly. However when there is a tag on the table being recognized the keyboard no longer focuses on the textblock and wont react to user touch input. I thought layering the content zindex would solve this but I was wrong...

What is frustrating is that my code works with the Surface Input Simulator tools but not on the device itself. (tag and touch tool options, not mouse).

  • The tags are precisely cutout and do not appear as blobs / finger touches on the table.
  • Dragging and dropping of content from scatterview to librarybars etc all work as intended.
  • Other buttons and touch elements are all working as intended
  • The Source for each tag is IsHitTestVisible=false and has no buttons etc (only a Ellipse which shows me where the tag is if being recognised)
  • Only the keyboard functionality is not functioning as I thought it was intended.

I believe the reason behind this is due to that the Tag captures the Mouse context and won't let go and the default Keyboard functionality needs not the touch input but the single mouse event. How would I go about making the Keyboard work on a SurfaceTextBox - Inside a UserControl - when a Tag is being recognized?

I'm new to WPF and this problem is causing me a minor headache...I have looked at the SDK examples and I cannot find a solution for this.. Is there something stupid I am doing or something simple not doing/have missed?

Any help would be appreciative :)

回答1:

After researching more about the keyboard structure of Surface 2.0 programs and again following the Shopping Cart example you have to use the Surface 2.0 Keyboard, not the Tablet one (the one you can toggle on/off in the control panel). I made the foolish error in thinking that both the keyboards can operate the same... nope.

The Surface 2.0 keyboard accepts touch input and works with TagVisualizers. This is due binding the keyboard to certain SurfaceTextBoxes and it taking in touch input even when the mouse has not clicked on it.

The Tablet windows default keyboard does not work with touch input unless a mouse input has touched it (when there is no other input the last and current active touch input is promoted to a mouse). This keyboard always shows when no over keyboard is specified and it is enabled in the Control Panel. This is tedious to work with TagVisualizers as when there is no mouse/touch input but there is a recognized tag.. this tag will steal the contact and until you take it off.

This problem does not exist with the Surface 2.0 keyboard. When you develop with the Surface 2.0 keyboard the Tablet keyboard will take it's place (annoyingly) until you run your software via the Surface Shell...

To develop your program and see the Surface 2.0 Keyboard you will have to have a development environment for and on a set up for Surface. E.g. develop on a Samsung SUR40 etc

  1. http://msdn.microsoft.com/en-us/library/ff727875.aspx Testing in Windows mode
  2. http://msdn.microsoft.com/en-us/library/ff727840.aspx Testing/debugging for surface
  3. http://msdn.microsoft.com/en-us/library/ff727766.aspx Surface Keyboard

P.s. I believe this is correct... I am still researching on this issue and if I find a way around this Ill update my answer...

Edit:

To extend this answer.. You should code the application to use the Surface Shell, via the launcher you should either launch your application from the selection of available applications and / or set the shell to one application mode if you're programming for a store environment.