Solved

WPF ListView Scrollviewer

Posted on 2014-04-08
1
521 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

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

Question has a verified solution.

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

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

820 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