在 Silverlight 中更改 TouchPoint 的 Position 属性

发布于 2024-12-21 13:58:24 字数 567 浏览 3 评论 0原文

我正在开发一个 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

野心澎湃 2024-12-28 13:58:24

您必须向 TouchPoint.SetValue 提供依赖属性:

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

请注意,典型的应用程序不应执行此操作,TouchPoint 类的 Position 属性是只读的是有充分理由的。典型的应用程序代码不必生成接触点。如果你必须这样做,你应该问自己是否没有更好的方法。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文