title: WPF Custom Buttons below ListBox Items
body: <p>WPF Experts - </p>
  
  <p>I am trying to add buttons below my custom listbox and also have the scroll bar go to the bottom of the control.  Only the items should move and not the buttons.  I was hoping for some guidance on the best way to achieve this.  I was thinking the ItemsPanelTemplate needed to be modified but was not certain.</p>
  
  <p>Thanks</p>
  
  <p><a href="https://i.stack.imgur.com/NlGWh.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NlGWh.png" alt="alt text"></a>
  </p>
  
  <p>My code is below</p>
  
  <pre><code>   &lt;!-- List Item Selected --&gt;
      &lt;LinearGradientBrush x:Key="GotFocusStyle"  EndPoint="0.5,1" StartPoint="0.5,0"&gt;
          &lt;LinearGradientBrush.GradientStops&gt;
              &lt;GradientStop Color="Black" Offset="0.501"/&gt;
              &lt;GradientStop Color="#FF091F34"/&gt;
              &lt;GradientStop Color="#FF002F5C" Offset="0.5"/&gt;
          &lt;/LinearGradientBrush.GradientStops&gt;
      &lt;/LinearGradientBrush&gt;
  
      &lt;!-- List Item Hover --&gt;
      &lt;LinearGradientBrush x:Key="MouseOverFocusStyle" StartPoint="0,0" EndPoint="0,1"&gt;
          &lt;LinearGradientBrush.GradientStops&gt;
              &lt;GradientStop Color="#FF013B73" Offset="0.501"/&gt;
              &lt;GradientStop Color="#FF091F34"/&gt;
              &lt;GradientStop Color="#FF014A8F" Offset="0.5"/&gt;
              &lt;GradientStop Color="#FF003363" Offset="1"/&gt;
          &lt;/LinearGradientBrush.GradientStops&gt;
      &lt;/LinearGradientBrush&gt;
  
      &lt;!-- List Item Selected --&gt;
      &lt;LinearGradientBrush x:Key="LostFocusStyle" EndPoint="0.5,1" StartPoint="0.5,0"&gt;
          &lt;LinearGradientBrush.RelativeTransform&gt;
              &lt;TransformGroup&gt;
                  &lt;ScaleTransform CenterX="0.5" CenterY="0.5"/&gt;
                  &lt;SkewTransform CenterX="0.5" CenterY="0.5"/&gt;
                  &lt;RotateTransform CenterX="0.5" CenterY="0.5"/&gt;
                  &lt;TranslateTransform/&gt;
              &lt;/TransformGroup&gt;
          &lt;/LinearGradientBrush.RelativeTransform&gt;
          &lt;GradientStop Color="#FF091F34" Offset="1"/&gt;
          &lt;GradientStop Color="#FF002F5C" Offset="0.4"/&gt;
      &lt;/LinearGradientBrush&gt;
  
      &lt;!-- List Item Highlight --&gt;
      &lt;SolidColorBrush x:Key="ListItemHighlight" Color="#FFE38E27" /&gt;
  
      &lt;!-- List Item UnHighlight --&gt;
      &lt;SolidColorBrush x:Key="ListItemUnHighlight" Color="#FF6FB8FD" /&gt;
  
      &lt;Style TargetType="ListBoxItem"&gt;
          &lt;EventSetter Event="GotFocus" Handler="ListItem_GotFocus"&gt;&lt;/EventSetter&gt;
          &lt;EventSetter Event="LostFocus" Handler="ListItem_LostFocus"&gt;&lt;/EventSetter&gt;
      &lt;/Style&gt;
  
      &lt;DataTemplate x:Key="CustomListData" DataType="{x:Type ListBoxItem}"&gt;
          &lt;Border BorderBrush="Black" BorderThickness="1"  Margin="-2,0,0,-1"&gt;
              &lt;Grid&gt;
                  &lt;Grid.ColumnDefinitions&gt;
                      &lt;ColumnDefinition Width="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ListBoxItem}}, Path=ActualWidth}" /&gt;
                  &lt;/Grid.ColumnDefinitions&gt;
                  &lt;Label 
                          VerticalContentAlignment="Center" BorderThickness="0" BorderBrush="Transparent"
                          Foreground="{StaticResource ListItemUnHighlight}"
                          FontSize="24"
                          Tag="{Binding .}"
                          Grid.Column="0"
                          MinHeight="55"
                          Cursor="Hand"
                          FontFamily="Arial"
                          FocusVisualStyle="{x:Null}"
                          KeyboardNavigation.TabNavigation="None"
                          Background="{StaticResource LostFocusStyle}"
                          MouseMove="ListItem_MouseOver"
                          &gt;
                      &lt;Label.ContextMenu&gt;
                          &lt;ContextMenu Name="editMenu"&gt;
                              &lt;MenuItem Header="Edit"/&gt;
                          &lt;/ContextMenu&gt;
                      &lt;/Label.ContextMenu&gt;
                      &lt;TextBlock Text="{Binding .}" Margin="15,0,40,0" TextWrapping="Wrap"&gt;&lt;/TextBlock&gt;
                  &lt;/Label&gt;
                  &lt;Image 
                      Tag="{Binding .}"
                      Source="{Binding}"
                      Margin="260,0,0,0"
                      Grid.Column="1"
                      Stretch="None"
                      Width="16"
                      Height="22" 
                      HorizontalAlignment="Center"
                      VerticalAlignment="Center" 
                      /&gt;
              &lt;/Grid&gt;
          &lt;/Border&gt;
      &lt;/DataTemplate&gt;
  
  &lt;/Window.Resources&gt;
  
  &lt;Window.DataContext&gt;
      &lt;ObjectDataProvider ObjectType="{x:Type local:ImageLoader}"  MethodName="LoadImages"  /&gt;
  &lt;/Window.DataContext&gt;
  
  
  &lt;ListBox ItemsSource="{Binding}" Width="320" Background="#FF021422" BorderBrush="#FF1C4B79" &gt;
  
      &lt;ListBox.Resources&gt;
          &lt;SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}"&gt;Transparent&lt;/SolidColorBrush&gt;
  
          &lt;Style TargetType="{x:Type ListBox}"&gt;
              &lt;Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled" /&gt;
              &lt;Setter Property="ItemTemplate" Value="{StaticResource CustomListData }" /&gt;
          &lt;/Style&gt;
  
      &lt;/ListBox.Resources&gt;
  
  &lt;/ListBox&gt;
  </code></pre>