有沒有人知道一個簡單的方法來捕捉一個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
一位同事建議作爲最後的手段使用線程來做跟蹤工作。我最終實現了** BackgroundWorker **類。雖然效率低下,但它似乎是跟蹤運動中ScatterViewItems位置的唯一方式。也許在將來我會利用Affine2DInertiaCompleted事件,如果我用自己的對象替換ScatterViewItems。 – CountZachula