2011-09-15 54 views
0

有没有人知道一个简单的方法来捕捉一个ScatterViewItem的位置(中心属性),一旦它失去了势头,并在屏幕上轻弹后停下来?我设置了一个“热点”区域,我希望在物品在其范围内停止时启动文件传输。Surface SDK中ScatterViewItem位置更改的事件处理程序?

到目前为止,我已经尝试了的PropertyChanged通知,但没有成功:

---OvelayWrapper.xaml.cs--- 
    --------------------------- 
    public event PropertyChangedEventHandler PropertyChanged; 

    public Point CurrentLocation 
    { 
     get 
     { 
      return _CurrentLocation; 
     } 
     set 
     { 
      _CurrentLocation = value; 
      OnPropertyChanged("CurrentLocation"); 
     } 
    } 
    protected void OnPropertyChanged(string newLoc) 
    { 
     PropertyChangedEventHandler handler = PropertyChanged; 
     if (handler != null) 
     { 
      handler(this, new PropertyChangedEventArgs(newLoc)); 
     } 
     Console.WriteLine("New Location Recorded"); 
    } 


    ---OverlayWrapper.xaml--- 
    ------------------------- 
    <s:ScatterViewItem Center="{Binding Path=CurrentLocation}"> 
      <Label Content="Test" /> 
    </s:ScatterViewItem> 

ScatterViewItems有,我用它来跟踪与缩放SizedChanged事件处理程序,但它没有意义,一个TranslationChanged事件处理程序将不存在。

此外,我无法使用ScatterViewItem的ManipulationStarting/Delta/Completed事件。提前

感谢,

-Z

+0

一位同事建议作为最后的手段使用线程来做跟踪工作。我最终实现了** BackgroundWorker **类。虽然效率低下,但它似乎是跟踪运动中ScatterViewItems位置的唯一方式。也许在将来我会利用Affine2DInertiaCompleted事件,如果我用自己的对象替换ScatterViewItems。 – CountZachula

回答

1

使用ScatterManipulationDelta的位置,大小和旋转

编辑:增量没有改变

+0

我没有看到** ScatterManipulationChanged **作为ScatterViewItem类的字段。顺便说一句,我使用的是Surface 2.0 SDK。 – CountZachula

+0

呐喊解决了我的错误 –