Solved

WPF ListView Scrollviewer

Posted on 2014-04-08
1
514 Views
Last Modified: 2014-04-08
How do I access a WPF ListView's ScrollViewer through VB.NET? All the examples I can find online are C# and I'm having problems translating these into VB.NET ... Some of the syntax doesn't make sense to me. Sorry....

P
0
Comment
Question by:WernerVonBraun
1 Comment
 
LVL 4

Accepted Solution

by:
WernerVonBraun earned 0 total points
ID: 39987019
Never mind... I figured out a solution:

    Public Shared Function GetListViewScrollViewer(ByVal oLV As ListView) As ScrollViewer
        Dim oDO As DependencyObject
        oDO = TryCast(oLV, DependencyObject)

        Return GetScrollViewer(oLV)

    End Function

    Public Shared Function GetScrollViewer(ByVal oDO As DependencyObject) As ScrollViewer

        Dim nChild As Integer
        Dim oDOChild As DependencyObject
        Dim oSV As ScrollViewer
        For nChild = 0 To VisualTreeHelper.GetChildrenCount(oDO) - 1
            oDOChild = VisualTreeHelper.GetChild(oDO, nChild)
            oSV = TryCast(oDOChild, ScrollViewer)
            If Not oSV Is Nothing Then
                Return oSV
            End If
            oSV = GetScrollViewer(oDOChild)
            If Not oSV Is Nothing Then
                Return oSV
            End If
        Next

        Return Nothing
    End Function

Open in new window

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
Need to grow your business through quality cloud solutions? With everything required to build a cloud platform and solution, you may feel like the distance between you and the cloud is quite long. Help is here. Spend some time learning about the Con…

948 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now