Avatar of MeritorWabco
MeritorWabco
 asked on

WPF Listbox Scroll to Bottom VB.Net

I am developing a WPF application that has a listbox.  In a standard windows form when I added an item to a listbox I could just use the TopIndex feature but that is not available in a WPF window.  

I have tried ScrollIntoView but I cannot get it to work.  Any help would be appreciated.

Thanks!
Public Sub UpdateStatus(ByVal s As String)
        Dim currDateTime As DateTime = DateTime.Now
        Dim sDateTime As String

        If (s <> gsLine) Then
            sDateTime = currDateTime.ToString("yyyyMMdd-HH:mm:ss> ")
        Else
            sDateTime = ""
        End If
        listStatus.BeginInit()
        listStatus.Items.Add(sDateTime + s)
        listStatus.ScrollIntoView(listStatus.Items.Count - 1)
        listStatus.EndInit()
    End Sub

Open in new window

Visual Basic.NET

Avatar of undefined
Last Comment
MeritorWabco

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Mike Tomlinson

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
MeritorWabco

ASKER
Yeah I am a WPF noob also :).  But i got it to work also.  I tried using the ScrollViewer several different ways and still couldn't get it to work. I guess I just don't know what I am doing and it is showing!
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes