Wpf 向下滚动时获取listview中的坐标

Wpf 向下滚动时获取listview中的坐标,wpf,vb.net,listview,scroll,coordinate,Wpf,Vb.net,Listview,Scroll,Coordinate,我想得到我在向下滚动列表视图时单击的点的“真实”Y值 以下是XAML: <Window x:Class="MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" MaxHeight="350" MinHeight="350" Width="525

我想得到我在向下滚动列表视图时单击的点的“真实”Y值

以下是XAML:

<Window x:Class="MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" MaxHeight="350" MinHeight="350" Width="525">
<Grid>
    <ListView Name="MyListView" ScrollViewer.CanContentScroll="True" ScrollViewer.VerticalScrollBarVisibility="Auto">
    </ListView>
</Grid>
</Window>
我现在的问题是,无论向下滚动多远,顶部总是1,底部总是309,但向下滚动时,我希望得到高于309的值。 有没有办法找到我点击的“真实”Y坐标,或者找到我向下滚动了多远,然后能够计算出调整后的值? 顺便说一句,在scrollviewer控件中包装listview不是一个选项


感谢您提供的所有答案

为了确定实际的Y值,您需要知道scrollviewer可以告诉您的滚动量

您可以将scrollviewer作为listview的子级(
Media.VisualTreeHelper.GetChild(Mylistview,0.child)
)获取,并从中获取当前的垂直偏移量(
scrollviewer.VerticalOffset
)。
垂直偏移量不提供y坐标偏移量,而是提供向下滚动的listview项目量。您可以轻松地使用它。

欢迎使用Staock Overflow。你的问题写得很好,但是你可以通过添加描述问题相关语言的标签来改进。谢谢,我感谢你的帮助。希望有人能真正回答这个问题。我不是一个vb.net的人,但一般来说,我希望这个问题的答案包括询问滚动条滚动了多远。这是我的第一个想法,但我不知道如何访问ListView的内置ScrollViewer。我不想在控件周围附加一个scrollviewer。欢迎使用vb.net或C#解决方案。
Class MainWindow 
Sub New()
    InitializeComponent()
    For i As Integer = 0 To 100
        MyListView.Items.Add(i)
    Next
End Sub
Private Sub MyListView_MouseLeftButtonUp(sender As Object, e As MouseButtonEventArgs) Handles MyListView.MouseLeftButtonUp
    MsgBox(e.GetPosition(MyListView).Y)
End Sub
End Class