I am replacing the scroll bar for a list view with a “scroll up” and “scroll down” buttons. My question is, is there any way to show the buttons only when the list box can be scrolled?
i.e. My listbox may only have a couple of items…in that case I wouldn’t need to show the buttons becuase there is nothing to scroll to.
I’m implmenting this across multiple listboxes and there is no set size of the items/lisboxes. I’m hoping there is some event that I can hook onto like a “scrollviewer_initializeed” or something.
Set the ListBox.ScrollView.VerticalScrollBarVisibility to Hidden and handle the ListBox.ScrollView.ScrollChanged event like this:
And then add this method to handle the ScrollChanged event:
This is assuming your buttons are named ButtonScrollUp and ButtonScrollDown.
ScrollViewer.ScrollableHeight will equal the number of items out of view, so if it is greater than 0 your buttons should be visible.