【问题标题】:Change Position property of TouchPoint in Silverlight在 Silverlight 中更改 TouchPoint 的位置属性
【发布时间】:2011-12-16 13:57:29
【问题描述】:

我正在开发一个 Silverlight 应用程序。在这个我想模拟接触点。有什么方法可以创建具有更改位置的 TouchPoint 或在创建后更改位置?我试过这个(来自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:无法从 'string' 转换为 'System.Windows.DependencyProperty'” 基本上我正在尝试生成具有不同位置的接触点。任何帮助表示赞赏。

【问题讨论】:

    标签: c# silverlight dependency-properties


    【解决方案1】:

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

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

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

    【讨论】:

      猜你喜欢
      • 2014-12-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-12-15
      • 1970-01-01
      • 2016-01-09
      • 1970-01-01
      相关资源
      最近更新 更多