title: Scrolling ListBox with buttons WPF
body: <p>How can i scroll by sections using buttons in WPF? </p>
  
  <p>I have the next ListBox:</p>
  
  <p><a href="https://i.stack.imgur.com/geJi2.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/geJi2.png" alt="enter image description here"></a></p>
  
  <p>I need each arrow (buttons) from left &amp; right to perform the scroll action (back &amp; next)</p>
  
  <p>Here is my code of the ListBox (since the code of the buttons are not so important i am just pasting the ListBox code)</p>
  
  <pre><code>&lt;ListBox Grid.Column="1" Grid.Row="1" Name="CategoriesListBox" ScrollViewer.VerticalScrollBarVisibility="Disabled" ScrollViewer.HorizontalScrollBarVisibility="Hidden" Background="#00FFFFFF" BorderBrush="{x:Null}"&gt;
                      &lt;ListBox.ItemsPanel&gt;
                          &lt;ItemsPanelTemplate&gt;
                              &lt;UniformGrid Rows="2" VerticalAlignment="Center" Background="#00FFFFFF"/&gt;
                          &lt;/ItemsPanelTemplate&gt;
                      &lt;/ListBox.ItemsPanel&gt;
                      &lt;ListBox.ItemContainerStyle&gt;
                          &lt;Style TargetType="{x:Type ListBoxItem}"&gt;
                              &lt;Setter Property="Focusable" Value="False"/&gt;
                          &lt;/Style&gt;
                      &lt;/ListBox.ItemContainerStyle&gt;
                      &lt;ListBox.ItemTemplate&gt;
                          &lt;DataTemplate&gt;
                              &lt;Button Height="{Binding ElementName=DummyGrid, Path=ActualHeight}" Width="{Binding ElementName=DummyGrid, Path=ActualWidth}" Margin="2"&gt;
                                  &lt;Button.Content&gt;
                                      &lt;Viewbox Stretch="Uniform" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"&gt;
                                          &lt;TextBlock Foreground="White" FontFamily="/BundyPOS;component/Fonts/#HelveticaRounded" TextAlignment="Center" Margin="7" Text="{Binding a}"&gt;&lt;/TextBlock&gt;
                                      &lt;/Viewbox&gt;
                                  &lt;/Button.Content&gt;
                                  &lt;Button.Style&gt;
                                      &lt;Style TargetType="{x:Type Button}"&gt;
                                          &lt;Setter Property="Background" Value="{Binding color}"/&gt;
                                          &lt;Setter Property="Template"&gt;
                                              &lt;Setter.Value&gt;
                                                  &lt;ControlTemplate TargetType="{x:Type Button}"&gt;
                                                      &lt;Border CornerRadius="15" BorderBrush="White" BorderThickness="2,2,2,2" Background="{TemplateBinding Background}"&gt;
                                                          &lt;ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/&gt;
                                                      &lt;/Border&gt;
                                                  &lt;/ControlTemplate&gt;
                                              &lt;/Setter.Value&gt;
                                          &lt;/Setter&gt;
                                          &lt;Style.Triggers&gt;
                                              &lt;Trigger Property="IsMouseOver" Value="True"&gt;
                                                  &lt;Setter Property="Background" Value="#3cb878"/&gt;
                                                  &lt;Setter Property="Foreground" Value="Black"/&gt;
                                              &lt;/Trigger&gt;
                                          &lt;/Style.Triggers&gt;
                                      &lt;/Style&gt;
                                  &lt;/Button.Style&gt;
                              &lt;/Button&gt;
                          &lt;/DataTemplate&gt;
                      &lt;/ListBox.ItemTemplate&gt;
                  &lt;/ListBox&gt;
  </code></pre>
  
  <p>I cant perform <code>ListBox.ScrollIntoView(categoryItem[position]);</code> because the ListBox could have different row or values per row. Is there any function like "scrollToHorizontalOffset"?</p>