user1102059
user1102059

Reputation: 21

Change Position property of TouchPoint in Silverlight

I'm developing a Silverlight application. In this I want to simulate TouchPoints. Is there any way I can create a TouchPoint with a changed position or alter the position after creation? I`ve tried this (from http://mail.java2s.com/Open-Source/CSharp/Testing/gesturetoolkit/TouchToolKit/Framework/Utility/TouchPointHelper.cs.htm) :

TouchPoint touch = new TouchPoint();
touch.SetValue("Position", new point(x,y));

This doesn't work with the error : "Error 197 Argument 1: cannot convert from 'string' to 'System.Windows.DependencyProperty'" Basically I'm trying to generate TouchPoints with different positions. Any help appreciated.

Upvotes: 0

Views: 122

Answers (1)

Falanwe
Falanwe

Reputation: 4744

You have to provide the dependency property to TouchPoint.SetValue :

touch.SetValue(TouchPoint.PositionProperty, new point(x,y));

Note that a typical application should not be doing this, the Position property of the TouchPoint class is read only for a good reason. Typical application code should not have to generate TouchPoints. If you have to do this, you should ask yourself if there is no better way.

Upvotes: 1

Related Questions