Get a ListBox to scroll to end in WPF VB.net Visual Basic
Account Home | Help | Blog | Contact us | Log Out


Welcome to Kbytes > Articles

Get a ListBox to scroll to end in WPF VB.net Visual Basic

Posted By: siteadmin on 21/10/2013 11:46:00

As discussed here in C#

You can get a ListBox to scroll to end in WPF VB.net  Visual Basic

You can add two imports statements:

Imports System.Windows.Automation.Peers
Imports System.Windows.Automation.Provider
 
And then
 
Dim svAutomation As ListBoxAutomationPeer = DirectCast(ScrollViewerAutomationPeer.CreatePeerForElement(YOURLISTBOXWINDOW), ListBoxAutomationPeer)
 
Dim scrollInterface As IScrollProvider = DirectCast(svAutomation.GetPattern(PatternInterface.Scroll), IScrollProvider)
Dim scrollVertical As System.Windows.Automation.ScrollAmount = System.Windows.Automation.ScrollAmount.LargeIncrement
Dim scrollHorizontal As System.Windows.Automation.ScrollAmount = System.Windows.Automation.ScrollAmount.NoAmount
  'If the vertical scroller is not available, the operation cannot be performed, which will raise an exception. 
If scrollInterface.VerticallyScrollable Then
  scrollInterface.Scroll(scrollHorizontal, scrollVertical)
End If
 
 
 

blog comments powered by Disqus

Kbytes Home | Privacy Policy | Contact us | Testing Area

© 2004 - 2024 1 Oak Hill Grove Surbiton Surrey KT6 6DS Phone: +44(020) 8123 1321