在 Silverlight 中更改 TouchPoint 的 Position 属性
我正在开发一个 Silverlight 应用程序。在此我想模拟接触点。有什么方法可以创建位置已更改的接触点或在创建后更改位置?我已经尝试过这个(来自 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));
这不适用于错误:“错误 197 参数 1:无法从“字符串”转换为“System.Windows.DependencyProperty”” 基本上我正在尝试生成具有不同位置的接触点。任何帮助表示赞赏。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您必须向 TouchPoint.SetValue 提供依赖属性:
请注意,典型的应用程序不应执行此操作,TouchPoint 类的 Position 属性是只读的是有充分理由的。典型的应用程序代码不必生成接触点。如果你必须这样做,你应该问自己是否没有更好的方法。
You have to provide the dependency property to
TouchPoint.SetValue
: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.