I have a listview which is quite small in height, but has 3-4 listviewitems which takes up the whole size of the Listview (so only one item can be displayed at once)
I assume you're talking about the MouseWheel scroll here.
The MouseWheel scroll really depends on the IScrollInfo
implementation. I suggest you to handle the MouseWheel event yourself before the ScrollViewer
does. So basically, you could do something like following:
Handle the PreviewMouseWheel
event on ListBox
In the code behind, fire the ScrollBar.LineDownCommand
or ScrollBar.LineUpCommand
when you scroll down or up.
private void ListBox_PreviewMouseWheel(object sender, MouseWheelEventArgs e)
{
if (e.Delta > 0)
{
ScrollBar.LineDownCommand.Execute(null, e.OriginalSource as IInputElement);
}
if (e.Delta < 0)
{
ScrollBar.LineUpCommand.Execute(null, e.OriginalSource as IInputElement);
}
e.Handled = true;
}
Therefore, you turned the MouseWheel scroll into the LineDown/LineUp.