Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

WPF ListView Scrollviewer

Posted on 2014-04-08
1
Medium Priority
?
584 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

Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

Question has a verified solution.

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

It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Integration Management Part 2
Loops Section Overview

876 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