I'm trying to eliminate TouchDevices in a WPF for Surface so I can ignore non-finger touches because blobs seem to trigger events I don't want.
At first I had something simple like this
private void SurfaceWindow1_PreviewTouchDown(object sender, TouchEventArgs e)
{
if (!e.TouchDevice.GetIsFingerRecognized() && InteractiveSurface.PrimarySurfaceDevice.IsFingerRecognitionSupported == true)
{
e.Handled = true;
}
}
Which works well to stop touch interactions with things like inside ScatterViewItems and manipulations. however there must be something else that happens before PreviewTouchDown because I can use a blob to activate an SVI and bring it to the top although no other manipulations occur. I'm guessin TouchEnter on the SVI still shows up and brings it forward but handling TouchEnter on all the elements gives me the same thing so there's still something else going on.
I looked into Touch.FrameReported but I can't release the proper TouchCaptures before the SVIs hear about it
private void myTouchFrameHandler(object sender, TouchFrameEventArgs e)
{
foreach (TouchPoint _tp in e.GetTouchPoints(this)) {
if (!_tp.TouchDevice.GetIsFingerRecognized())
{
this.ReleaseAllTouchCaptures();
}
}
}
Any ideas?
Thanks
I stumbled upon the same problem and implemented an attached behavior for ScatterViewItems. This behavior disables the automatic IsTopmostOnActivation behavior and listens to PreviewTouchDown events to decide if an item is to be brought to top based on a test condition. It features an easy to use activation method
CustomTopmostBehavior.Activate();
which adds an application-wide style enabling the behavior for all ScatterViewItems.
The behavior can be customized by setting its TestCondition property which is by default:
CustomTopmostBehavior.TestCondition = (t) =>
{
return t.GetIsFingerRecognized();
};