Remove this
<ListBox.Template>
<ControlTemplate TargetType="{x:Type ListBox}">
<ScrollViewer CanContentScroll="True" VerticalScrollBarVisibility="Auto" PanningMode="VerticalOnly">
<StackPanel>
<ItemsPresenter/>
</StackPanel>
</ScrollViewer>
</ControlTemplate>
</ListBox.Template>
Listbox has its own default scrollviewer inside the template, why do you need to change the template of the listbox if all I see is the ScrollViewer and a StackPanel? And then you'll redefine the ItemPanelTemplate to a WrapPanel.
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
There is a static class called ScrollViewer where you can control its scrollviewer's properties.
<ListBox ScrollViewer.VerticalScrollBarVisibility="Auto"/>