Every now and again i come across developer questions like why is manipulation delta slow etc. Let me tell you why.
UIElement Silverlight for #windowsphone exposes a few events like
http://msdn.microsoft.com/en-us/library/system.windows.uielement(v=vs.95).aspx
![]() ![]() |
ManipulationCompleted | Occurs when a manipulation and inertia on the UIElement is complete. |
![]() ![]() |
ManipulationDelta | Occurs when the input device changes position during a manipulation. |
![]() ![]() |
ManipulationStarted | Occurs when an input device begins a manipulation on the UIElement. |
These are high level touch interfaces and there is a significant overhead in reporting (and hence delay etc).
If you are say drawing on a bitmap or canvas, you dont want a min delta change before event is fired. For that lets look at low-level interface exposed in Silverlight.
http://msdn.microsoft.com/en-us/library/system.windows.input.touch(v=vs.95).aspx
![]() ![]() ![]() |
FrameReported | Occurs when the input system promotes a Windows 7 touch message for Silverlight. |
Touh.FrameReported is a low level method and has little overhead and is very very precise. Let me give you a code sample
Touch.FrameReported += Touch_FrameReported;
you can do above in Loaded event. Here’s the implementation of the Touch_FrameReported handler. WorkArea is Canvas in this. I have also used this in conjugation with WritableBitmap
private void Touch_FrameReported(object sender, TouchFrameEventArgs e)
{
try
{
// Determine if finger / mouse is down
point = e.GetPrimaryTouchPoint(this.workArea);
if (point.Position.X < 0 || point.Position.Y < 0)
return;
if (point.Position.X > this.workArea.Width || point.Position.Y > this.workArea.Height)
return;
if (this.lbLetter.SelectedIndex == -1)
return;
switch (point.Action)
{
case TouchAction.Down:
draw = true;
old_point = point;
goto default;
case TouchAction.Up:
draw = false;
break;
default:
Draw();
break;
}
}
catch
{
MessageBox.Show("Application encountered error processing last request.");
}
}
I hope this is useful to #windowsphone developers out there.


