ListBoxItem绝对位置,Windows Phone 7

aus*_*ush 3 listbox listboxitem windows-phone-7

如何根据整个ListBox和可见的ScrollViewer区域获取ListBoxItem(它的左上角)的绝对(X,Y)位置?看起来WP7下没有TranslatePoint().

aus*_*ush 5

找到了方法.

var selectedItem = listBox.ItemContainerGenerator.ContainerFromItem(listBox.SelectedItem) as ListBoxItem;
var transformToVisual = selectedItem.TransformToVisual(listBox);
var transform = transformToVisual.Transform(new Point(0, 0));
Run Code Online (Sandbox Code Playgroud)