Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何根据整个 ListBox 和可见的 ScrollViewer 区域获取 ListBoxItem 的绝对(X,Y)位置(它的左上角)?WP7下好像没有TranslatePoint()。
找到了方法。
var selectedItem = listBox.ItemContainerGenerator.ContainerFromItem(listBox.SelectedItem) as ListBoxItem; var transformToVisual = selectedItem.TransformToVisual(listBox); var transform = transformToVisual.Transform(new Point(0, 0));