title: How set property background "Transparent" in listbox
body: <p>I have ListBox and i need set background "Transparent".</p>
  
  <p><img src="https://i.stack.imgur.com/4rPXf.jpg" alt="alt text"></p>
  
  <p>I've selected in red, then that should be transparent:
  <img src="https://i.stack.imgur.com/u8SH3.jpg" alt="alt text"></p>
  
  <p>style ListBox, ListBoxItem, ScrollViewer and ScrollBar:</p>
  
  <pre><code>&lt;Style TargetType="{x:Type ScrollBar}"&gt;
      &lt;Setter Property="Stylus.IsFlicksEnabled" Value="false"/&gt;
      &lt;Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/&gt;
      &lt;Setter Property="Template"&gt;
          &lt;Setter.Value&gt;
              &lt;ControlTemplate TargetType="{x:Type ScrollBar}"&gt;
                  &lt;Grid x:Name="GridRoot" Width="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}"&gt;
                      &lt;Grid.RowDefinitions&gt;
                          &lt;RowDefinition MaxHeight="18"/&gt;
                          &lt;RowDefinition Height="0.00001*"/&gt;
                          &lt;RowDefinition MaxHeight="18"/&gt;
                      &lt;/Grid.RowDefinitions&gt;
                      &lt;Rectangle Grid.RowSpan="5" RadiusX="0" RadiusY="0" StrokeThickness="1" Stroke="#FFF0F0F0" Fill="#FFEFEFEF"/&gt;
                      &lt;RepeatButton x:Name="DecreaseRepeat" Style="{DynamicResource NuclearRepeatButton}" Command="ScrollBar.LineUpCommand"&gt;
                          &lt;Grid&gt;
                              &lt;Path x:Name="ArrowUp" Height="6" Width="10" Data="F1 M 541.537,173.589L 531.107,173.589L 536.322,167.49L 541.537,173.589 Z " HorizontalAlignment="Center" VerticalAlignment="Center" Stretch="Uniform" IsHitTestVisible="False"&gt;
                                  &lt;Path.Fill&gt;
                                      &lt;LinearGradientBrush EndPoint="0.7,0.75" StartPoint="0.25,0"&gt;
                                          &lt;GradientStop Color="#CC000000" Offset="0.25"/&gt;
                                          &lt;GradientStop Color="#7F000000" Offset="0.75"/&gt;
                                          &lt;GradientStop Color="#33000000" Offset="1"/&gt;
                                      &lt;/LinearGradientBrush&gt;
                                  &lt;/Path.Fill&gt;
                              &lt;/Path&gt;
                          &lt;/Grid&gt;
                      &lt;/RepeatButton&gt;
  
                      &lt;Track Grid.Row="1" x:Name="PART_Track" Orientation="Vertical" IsDirectionReversed="true"&gt;
                          &lt;Track.Thumb&gt;
                              &lt;Thumb Style="{DynamicResource NuclearThumbStyle}"/&gt;
                          &lt;/Track.Thumb&gt;
                          &lt;Track.IncreaseRepeatButton&gt;
                              &lt;RepeatButton x:Name="PageUp" Style="{DynamicResource NuclearScrollRepeatButtonStyle}" Command="ScrollBar.PageDownCommand"/&gt;
                          &lt;/Track.IncreaseRepeatButton&gt;
                          &lt;Track.DecreaseRepeatButton&gt;
                              &lt;RepeatButton x:Name="PageDown" Style="{DynamicResource NuclearScrollRepeatButtonStyle}" Command="ScrollBar.PageUpCommand"/&gt;
                          &lt;/Track.DecreaseRepeatButton&gt;
                      &lt;/Track&gt;
  
                      &lt;RepeatButton Grid.Row="2" x:Name="IncreaseRepeat" Style="{DynamicResource NuclearRepeatButton}" Command="ScrollBar.LineDownCommand"&gt;
                          &lt;Grid&gt;
                              &lt;Path x:Name="ArrowDown" Grid.Row="4" Height="6" Width="10" Data="F1 M 531.107,321.943L 541.537,321.943L 536.322,328.042L 531.107,321.943 Z " HorizontalAlignment="Center" VerticalAlignment="Center" Stretch="Uniform" IsHitTestVisible="False"&gt;
                                  &lt;Path.Fill&gt;
                                      &lt;LinearGradientBrush EndPoint="0.4,1" StartPoint="-0.3,0"&gt;
                                          &lt;GradientStop Color="#CC000000" Offset="0.25"/&gt;
                                          &lt;GradientStop Color="#7F000000" Offset="0.75"/&gt;
                                          &lt;GradientStop Color="#33000000" Offset="1"/&gt;
                                      &lt;/LinearGradientBrush&gt;
                                  &lt;/Path.Fill&gt;
                              &lt;/Path&gt;
                          &lt;/Grid&gt;
                      &lt;/RepeatButton&gt;
                  &lt;/Grid&gt;
  
                  &lt;ControlTemplate.Triggers&gt;
                      &lt;Trigger Property="Orientation" Value="Horizontal"&gt;
  
                          &lt;Setter Property="LayoutTransform" TargetName="GridRoot"&gt;
                              &lt;Setter.Value&gt;
                                  &lt;RotateTransform Angle="-90"/&gt;
                              &lt;/Setter.Value&gt;
                          &lt;/Setter&gt;
  
                          &lt;Setter TargetName="PART_Track" Property="Orientation" Value="Vertical"/&gt;
  
                          &lt;Setter Property="Command" Value="ScrollBar.LineLeftCommand" TargetName="DecreaseRepeat"/&gt;
                          &lt;Setter Property="Command" Value="ScrollBar.LineRightCommand" TargetName="IncreaseRepeat"/&gt;
                          &lt;Setter Property="Command" Value="ScrollBar.PageLeftCommand" TargetName="PageDown"/&gt;
                          &lt;Setter Property="Command" Value="ScrollBar.PageRightCommand" TargetName="PageUp"/&gt;
                      &lt;/Trigger&gt;
                  &lt;/ControlTemplate.Triggers&gt;
              &lt;/ControlTemplate&gt;
          &lt;/Setter.Value&gt;
      &lt;/Setter&gt;
  &lt;/Style&gt;
  
  &lt;Style TargetType="{x:Type ScrollViewer}" BasedOn="{x:Null}"&gt;
      &lt;Setter Property="Template"&gt;
          &lt;Setter.Value&gt;
              &lt;ControlTemplate TargetType="{x:Type ScrollViewer}"&gt;
                  &lt;Grid Background="{TemplateBinding Background}"&gt;
                      &lt;Grid.ColumnDefinitions&gt;
                          &lt;ColumnDefinition Width="*"/&gt;
                          &lt;ColumnDefinition Width="Auto"/&gt;
                      &lt;/Grid.ColumnDefinitions&gt;
                      &lt;Grid.RowDefinitions&gt;
                          &lt;RowDefinition Height="*"/&gt;
                          &lt;RowDefinition Height="Auto"/&gt;
                      &lt;/Grid.RowDefinitions&gt;
                      &lt;ScrollContentPresenter Grid.Column="0" Grid.Row="0" Margin="{TemplateBinding Padding}" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" CanContentScroll="{TemplateBinding CanContentScroll}"/&gt;
  
                      &lt;ScrollBar Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}" Grid.Column="0" Grid.Row="1" x:Name="PART_HorizontalScrollBar"   Orientation="Horizontal" Value="{Binding Path=HorizontalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportWidth}" Minimum="0" Maximum="{TemplateBinding ScrollableWidth}" AutomationProperties.AutomationId="HorizontalScrollBar"/&gt;
                      &lt;ScrollBar Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}" Grid.Column="1" Grid.Row="0" x:Name="PART_VerticalScrollBar"   Orientation="Vertical" Value="{Binding Path=VerticalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportHeight}" Minimum="0" Maximum="{TemplateBinding ScrollableHeight}" AutomationProperties.AutomationId="VerticalScrollBar"/&gt;
                  &lt;/Grid&gt;
              &lt;/ControlTemplate&gt;
          &lt;/Setter.Value&gt;
      &lt;/Setter&gt;
  &lt;/Style&gt;
  
  
  &lt;!----&gt;
  &lt;ControlTemplate x:Key="ScrollViewerControlTemplate1" TargetType="{x:Type ScrollViewer}"&gt;
  &lt;Grid x:Name="Grid" Background="{TemplateBinding Background}"&gt;
      &lt;Grid.ColumnDefinitions&gt;
          &lt;ColumnDefinition Width="*"/&gt;
      &lt;/Grid.ColumnDefinitions&gt;
      &lt;Grid.RowDefinitions&gt;
          &lt;RowDefinition Height="*"/&gt;
      &lt;/Grid.RowDefinitions&gt;
      &lt;ScrollContentPresenter x:Name="PART_ScrollContentPresenter" Margin="{TemplateBinding Padding}" Grid.Column="0" Grid.Row="0" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" CanContentScroll="{TemplateBinding CanContentScroll}" CanHorizontallyScroll="False" CanVerticallyScroll="False"/&gt;
      &lt;ScrollBar x:Name="PART_HorizontalScrollBar" Cursor="Arrow" AutomationProperties.AutomationId="HorizontalScrollBar" Maximum="{TemplateBinding ScrollableWidth}" Minimum="0" Value="{Binding HorizontalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" Orientation="Horizontal"  Style="{DynamicResource ScrollBarStyle1}" Height="Auto" ScrollViewer.HorizontalScrollBarVisibility="Auto" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"/&gt;
  &lt;/Grid&gt;
  &lt;/ControlTemplate&gt;
  &lt;LinearGradientBrush x:Key="VerticalScrollBarBackground" EndPoint="1,0" StartPoint="0,0"&gt;
  &lt;GradientStop Color="#E1E1E1" Offset="0"/&gt;
  &lt;GradientStop Color="#EDEDED" Offset="0.20"/&gt;
  &lt;GradientStop Color="#EDEDED" Offset="0.80"/&gt;
  &lt;GradientStop Color="#E3E3E3" Offset="1"/&gt;
  &lt;/LinearGradientBrush&gt;
  &lt;SolidColorBrush x:Key="ScrollBarDisabledBackground" Color="#FFFFFF"/&gt;
  &lt;Style x:Key="ScrollBarButton" TargetType="{x:Type RepeatButton}"&gt;
  &lt;Setter Property="OverridesDefaultStyle" Value="true"/&gt;
  &lt;Setter Property="Focusable" Value="false"/&gt;
  &lt;Setter Property="IsTabStop" Value="false"/&gt;
  &lt;Setter Property="Template"&gt;
      &lt;Setter.Value&gt;
          &lt;ControlTemplate TargetType="{x:Type RepeatButton}"&gt;
              &lt;Microsoft_Windows_Themes:ScrollChrome x:Name="Chrome" SnapsToDevicePixels="true" RenderMouseOver="{TemplateBinding IsMouseOver}" RenderPressed="{TemplateBinding IsPressed}" Microsoft_Windows_Themes:ScrollChrome.ScrollGlyph="{TemplateBinding Microsoft_Windows_Themes:ScrollChrome.ScrollGlyph}"/&gt;
          &lt;/ControlTemplate&gt;
      &lt;/Setter.Value&gt;
  &lt;/Setter&gt;
  &lt;/Style&gt;
  &lt;Style x:Key="VerticalScrollBarPageButton" TargetType="{x:Type RepeatButton}"&gt;
  &lt;Setter Property="OverridesDefaultStyle" Value="true"/&gt;
  &lt;Setter Property="Background" Value="Transparent"/&gt;
  &lt;Setter Property="Focusable" Value="false"/&gt;
  &lt;Setter Property="IsTabStop" Value="false"/&gt;
  &lt;Setter Property="Template"&gt;
      &lt;Setter.Value&gt;
          &lt;ControlTemplate TargetType="{x:Type RepeatButton}"&gt;
              &lt;Rectangle Fill="{TemplateBinding Background}" Width="{TemplateBinding Width}" Height="{TemplateBinding Height}"/&gt;
          &lt;/ControlTemplate&gt;
      &lt;/Setter.Value&gt;
  &lt;/Setter&gt;
  &lt;/Style&gt;
  &lt;Style x:Key="ScrollBarThumb" TargetType="{x:Type Thumb}"&gt;
  &lt;Setter Property="OverridesDefaultStyle" Value="true"/&gt;
  &lt;Setter Property="IsTabStop" Value="false"/&gt;
  &lt;Setter Property="Template"&gt;
      &lt;Setter.Value&gt;
          &lt;ControlTemplate TargetType="{x:Type Thumb}"&gt;
              &lt;Microsoft_Windows_Themes:ScrollChrome x:Name="Chrome" SnapsToDevicePixels="true" RenderMouseOver="{TemplateBinding IsMouseOver}" RenderPressed="{TemplateBinding IsDragging}" Microsoft_Windows_Themes:ScrollChrome.ScrollGlyph="{TemplateBinding Microsoft_Windows_Themes:ScrollChrome.ScrollGlyph}"/&gt;
          &lt;/ControlTemplate&gt;
      &lt;/Setter.Value&gt;
  &lt;/Setter&gt;
  &lt;/Style&gt;
  &lt;LinearGradientBrush x:Key="HorizontalScrollBarBackground" EndPoint="0,1" StartPoint="0,0"&gt;
  &lt;GradientStop Color="#E1E1E1" Offset="0"/&gt;
  &lt;GradientStop Color="#EDEDED" Offset="0.20"/&gt;
  &lt;GradientStop Color="#EDEDED" Offset="0.80"/&gt;
  &lt;GradientStop Color="#E3E3E3" Offset="1"/&gt;
  &lt;/LinearGradientBrush&gt;
  &lt;Style x:Key="HorizontalScrollBarPageButton" TargetType="{x:Type RepeatButton}"&gt;
  &lt;Setter Property="OverridesDefaultStyle" Value="true"/&gt;
  &lt;Setter Property="Background" Value="Transparent"/&gt;
  &lt;Setter Property="Focusable" Value="false"/&gt;
  &lt;Setter Property="IsTabStop" Value="false"/&gt;
  &lt;Setter Property="Template"&gt;
      &lt;Setter.Value&gt;
          &lt;ControlTemplate TargetType="{x:Type RepeatButton}"&gt;
              &lt;Rectangle Fill="{TemplateBinding Background}" Width="{TemplateBinding Width}" Height="{TemplateBinding Height}"/&gt;
          &lt;/ControlTemplate&gt;
      &lt;/Setter.Value&gt;
  &lt;/Setter&gt;
  &lt;/Style&gt;
  &lt;Style x:Key="ScrollBarStyle1" TargetType="{x:Type ScrollBar}"&gt;
  &lt;Setter Property="Stylus.IsPressAndHoldEnabled" Value="false"/&gt;
  &lt;Setter Property="Stylus.IsFlicksEnabled" Value="false"/&gt;
  &lt;Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/&gt;
  &lt;Setter Property="Width" Value="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}"/&gt;
  &lt;Setter Property="MinWidth" Value="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}"/&gt;
  &lt;Setter Property="Template"&gt;
      &lt;Setter.Value&gt;
          &lt;ControlTemplate TargetType="{x:Type ScrollBar}"&gt;
              &lt;Grid x:Name="Bg" SnapsToDevicePixels="true" Background="{TemplateBinding Background}"&gt;
                  &lt;Grid.RowDefinitions&gt;
                      &lt;RowDefinition MaxHeight="{DynamicResource {x:Static SystemParameters.VerticalScrollBarButtonHeightKey}}"/&gt;
                      &lt;RowDefinition Height="0.00001*"/&gt;
                      &lt;RowDefinition MaxHeight="{DynamicResource {x:Static SystemParameters.VerticalScrollBarButtonHeightKey}}"/&gt;
                  &lt;/Grid.RowDefinitions&gt;
                  &lt;RepeatButton Style="{StaticResource ScrollBarButton}" IsEnabled="{TemplateBinding IsMouseOver}" Microsoft_Windows_Themes:ScrollChrome.ScrollGlyph="UpArrow" Command="{x:Static ScrollBar.LineUpCommand}"/&gt;
                  &lt;Track x:Name="PART_Track" IsEnabled="{TemplateBinding IsMouseOver}" Grid.Row="1" IsDirectionReversed="true"&gt;
                      &lt;Track.DecreaseRepeatButton&gt;
                          &lt;RepeatButton Style="{StaticResource VerticalScrollBarPageButton}" Command="{x:Static ScrollBar.PageUpCommand}"/&gt;
                      &lt;/Track.DecreaseRepeatButton&gt;
                      &lt;Track.IncreaseRepeatButton&gt;
                          &lt;RepeatButton Style="{StaticResource VerticalScrollBarPageButton}" Command="{x:Static ScrollBar.PageDownCommand}"/&gt;
                      &lt;/Track.IncreaseRepeatButton&gt;
                      &lt;Track.Thumb&gt;
                          &lt;Thumb Style="{StaticResource ScrollBarThumb}" Microsoft_Windows_Themes:ScrollChrome.ScrollGlyph="VerticalGripper"/&gt;
                      &lt;/Track.Thumb&gt;
                  &lt;/Track&gt;
                  &lt;RepeatButton Style="{StaticResource ScrollBarButton}" IsEnabled="{TemplateBinding IsMouseOver}" Grid.Row="2" Microsoft_Windows_Themes:ScrollChrome.ScrollGlyph="DownArrow" Command="{x:Static ScrollBar.LineDownCommand}"/&gt;
              &lt;/Grid&gt;
              &lt;ControlTemplate.Triggers&gt;
                  &lt;Trigger Property="IsEnabled" Value="false"&gt;
                      &lt;Setter Property="Background" TargetName="Bg" Value="{StaticResource ScrollBarDisabledBackground}"/&gt;
                  &lt;/Trigger&gt;
              &lt;/ControlTemplate.Triggers&gt;
          &lt;/ControlTemplate&gt;
      &lt;/Setter.Value&gt;
  &lt;/Setter&gt;
  &lt;Style.Triggers&gt;
      &lt;Trigger Property="Orientation" Value="Horizontal"&gt;
          &lt;Setter Property="Width" Value="Auto"/&gt;
          &lt;Setter Property="MinWidth" Value="0"/&gt;
          &lt;Setter Property="Height" Value="{DynamicResource {x:Static SystemParameters.HorizontalScrollBarHeightKey}}"/&gt;
          &lt;Setter Property="MinHeight" Value="{DynamicResource {x:Static SystemParameters.HorizontalScrollBarHeightKey}}"/&gt;
          &lt;Setter Property="Background" Value="{StaticResource HorizontalScrollBarBackground}"/&gt;
          &lt;Setter Property="Template"&gt;
              &lt;Setter.Value&gt;
                  &lt;ControlTemplate TargetType="{x:Type ScrollBar}"&gt;
                      &lt;Grid x:Name="Bg" SnapsToDevicePixels="true" VerticalAlignment="Stretch"&gt;
                          &lt;Grid.RowDefinitions&gt;
                              &lt;RowDefinition/&gt;
                          &lt;/Grid.RowDefinitions&gt;
                          &lt;Grid.ColumnDefinitions&gt;
                              &lt;ColumnDefinition MaxWidth="{DynamicResource {x:Static SystemParameters.HorizontalScrollBarButtonWidthKey}}"/&gt;
                              &lt;ColumnDefinition Width="0.00001*"/&gt;
                              &lt;ColumnDefinition MaxWidth="{DynamicResource {x:Static SystemParameters.HorizontalScrollBarButtonWidthKey}}"/&gt;
                          &lt;/Grid.ColumnDefinitions&gt;
                          &lt;RepeatButton Style="{StaticResource ScrollBarButton}" Microsoft_Windows_Themes:ScrollChrome.ScrollGlyph="LeftArrow" Command="{x:Static ScrollBar.LineLeftCommand}" Background="#FFEB0707"/&gt;
                          &lt;RepeatButton Style="{StaticResource ScrollBarButton}" Grid.Column="2" Microsoft_Windows_Themes:ScrollChrome.ScrollGlyph="RightArrow" Command="{x:Static ScrollBar.LineRightCommand}"/&gt;
                      &lt;/Grid&gt;
                  &lt;/ControlTemplate&gt;
              &lt;/Setter.Value&gt;
          &lt;/Setter&gt;
      &lt;/Trigger&gt;
  &lt;/Style.Triggers&gt;
  &lt;/Style&gt;
  &lt;!----&gt;
  
  
  
  
  
  
  &lt;Style TargetType="{x:Type ListBox}"&gt;
      &lt;Setter Property="SnapsToDevicePixels" Value="true"/&gt;
      &lt;Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/&gt;
      &lt;Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/&gt;
      &lt;Setter Property="ScrollViewer.CanContentScroll" Value="True"/&gt;
      &lt;Setter Property="HorizontalContentAlignment" Value="Stretch" /&gt;
      &lt;Setter Property="VerticalContentAlignment" Value="Center" /&gt;
      &lt;Setter Property="BorderBrush" Value="{StaticResource btnPressStroke2}"/&gt;
      &lt;Setter Property="BorderThickness" Value="1"/&gt;
      &lt;Setter Property="Padding" Value="1"/&gt;
      &lt;Setter Property="Foreground" Value="{StaticResource OutsideFontColor}"/&gt;
      &lt;Setter Property="Background" Value="Transparent"/&gt;
      &lt;Setter Property="Template"&gt;
          &lt;Setter.Value&gt;
              &lt;ControlTemplate TargetType="{x:Type ListBox}"&gt;
                  &lt;Grid&gt;
                      &lt;Border BorderThickness="{TemplateBinding BorderThickness}" Background="#FFFFFFFF" BorderBrush="{TemplateBinding BorderBrush}" CornerRadius="2"&gt;
                          &lt;ScrollViewer Template="{StaticResource ScrollViewerControlTemplate1}"  Margin="1"   Focusable="false" Background="Transparent"&gt;
                              &lt;WrapPanel Margin="2" IsItemsHost="True"  /&gt;
                          &lt;/ScrollViewer&gt;
                      &lt;/Border&gt;
                  &lt;/Grid&gt;
                  &lt;ControlTemplate.Triggers&gt;
                      &lt;Trigger Property="IsEnabled" Value="false"/&gt;
                      &lt;Trigger Property="IsGrouping" Value="true"&gt;
                          &lt;Setter Property="ScrollViewer.CanContentScroll" Value="false"/&gt;
                      &lt;/Trigger&gt;
                  &lt;/ControlTemplate.Triggers&gt;
              &lt;/ControlTemplate&gt;
          &lt;/Setter.Value&gt;
      &lt;/Setter&gt;
  &lt;/Style&gt;
  
  
  &lt;Style d:IsControlPart="True" TargetType="{x:Type ListBoxItem}"&gt;
      &lt;Setter Property="SnapsToDevicePixels" Value="true"/&gt;
      &lt;Setter Property="OverridesDefaultStyle" Value="true"/&gt;
      &lt;Setter Property="HorizontalContentAlignment" Value="Stretch" /&gt;
      &lt;Setter Property="VerticalContentAlignment" Value="Center" /&gt;
      &lt;Setter Property="Padding" Value="3" /&gt;
      &lt;Setter Property="Foreground" Value="{StaticResource OutsideFontColor}"/&gt;
      &lt;Setter Property="Background" Value="Transparent"/&gt;
      &lt;Setter Property="Template"&gt;
          &lt;Setter.Value&gt;
              &lt;ControlTemplate TargetType="{x:Type ListBoxItem}"&gt;
                  &lt;ControlTemplate.Resources&gt;
                      &lt;Storyboard x:Key="HoverOn"&gt;
                          &lt;DoubleAnimation Duration="00:00:00.1000000" Storyboard.TargetName="BackgroundGradientOver" Storyboard.TargetProperty="Opacity" To="0.73"/&gt;
                      &lt;/Storyboard&gt;
                      &lt;Storyboard x:Key="HoverOff"&gt;
                          &lt;DoubleAnimation Duration="00:00:00.4000000" Storyboard.TargetName="BackgroundGradientOver" Storyboard.TargetProperty="Opacity" To="0"/&gt;
                      &lt;/Storyboard&gt;
                      &lt;Storyboard x:Key="SelectedOn"&gt;
                          &lt;DoubleAnimation Duration="00:00:00.1000000" Storyboard.TargetName="BackgroundGradientSelected" Storyboard.TargetProperty="Opacity" To="0.84"/&gt;
                          &lt;DoubleAnimation Duration="00:00:00.1000000" Storyboard.TargetName="BackgroundGradientSelectedDisabled" Storyboard.TargetProperty="Opacity" To="1"/&gt;
                      &lt;/Storyboard&gt;
                      &lt;Storyboard x:Key="SelectedOff"&gt;
                          &lt;DoubleAnimation Duration="00:00:00.4000000" Storyboard.TargetName="BackgroundGradientSelected" Storyboard.TargetProperty="Opacity" To="0"/&gt;
                          &lt;DoubleAnimation Duration="00:00:00.4000000" Storyboard.TargetName="BackgroundGradientSelectedDisabled" Storyboard.TargetProperty="Opacity" To="0"/&gt;
                      &lt;/Storyboard&gt;
                  &lt;/ControlTemplate.Resources&gt;
                  &lt;Grid SnapsToDevicePixels="true"&gt;
                      &lt;Rectangle x:Name="BackgroundGradientOver" Fill="{StaticResource hoverGradient}" Stroke="{StaticResource hoverStroke}" RadiusX="2" RadiusY="2" Opacity="0"/&gt;
                      &lt;Rectangle x:Name="BackgroundGradientSelectedDisabled" Fill="{StaticResource grayGradient}" Stroke="#7F8E8F8F" RadiusX="2" RadiusY="2" Opacity="0"/&gt;
                      &lt;Rectangle x:Name="BackgroundGradientSelected" Fill="{StaticResource BtnOverFill}" Stroke="{StaticResource selectedStroke}" RadiusX="2" RadiusY="2" Opacity="0"/&gt;
                      &lt;Rectangle x:Name="BackgroundHighlight" Margin="1" Stroke="#A0FFFFFF" RadiusX="1" RadiusY="1"/&gt;
                      &lt;ContentPresenter
                      x:Name="contentPresenter"
                      Content="{TemplateBinding Content}"
                      ContentTemplate="{TemplateBinding ContentTemplate}"
                      HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                      Margin="{TemplateBinding Padding}"/&gt;
                  &lt;/Grid&gt;
                  &lt;ControlTemplate.Triggers&gt;
  
                      &lt;Trigger Property="IsSelected" Value="true"&gt;
                          &lt;Trigger.ExitActions&gt;
                              &lt;BeginStoryboard Storyboard="{StaticResource SelectedOff}" x:Name="SelectedOff_BeginStoryboard"/&gt;
                          &lt;/Trigger.ExitActions&gt;
                          &lt;Trigger.EnterActions&gt;
                              &lt;BeginStoryboard Storyboard="{StaticResource SelectedOn}" x:Name="SelectedOn_BeginStoryboard"/&gt;
                          &lt;/Trigger.EnterActions&gt;
  
                      &lt;/Trigger&gt;
                      &lt;Trigger Property="IsMouseOver" Value="True"&gt;
                          &lt;Trigger.ExitActions&gt;
                              &lt;BeginStoryboard Storyboard="{StaticResource HoverOff}" x:Name="HoverOff_BeginStoryboard"/&gt;
                          &lt;/Trigger.ExitActions&gt;
                          &lt;Trigger.EnterActions&gt;
                              &lt;BeginStoryboard Storyboard="{StaticResource HoverOn}"/&gt;
                          &lt;/Trigger.EnterActions&gt;
                      &lt;/Trigger&gt;
  
                      &lt;Trigger Property="IsEnabled" Value="false"&gt;
                          &lt;Setter Property="Foreground" Value="{DynamicResource DisabledForegroundBrush}"/&gt;
                          &lt;Setter Property="Visibility" TargetName="BackgroundGradientSelected" Value="Hidden"/&gt;
                      &lt;/Trigger&gt;
                  &lt;/ControlTemplate.Triggers&gt;
              &lt;/ControlTemplate&gt;
          &lt;/Setter.Value&gt;
      &lt;/Setter&gt;
  &lt;/Style&gt;
  
  &lt;Style x:Key="ExpanderHeaderFocusVisual"&gt;
      &lt;Setter Property="Control.Template"&gt;
          &lt;Setter.Value&gt;
              &lt;ControlTemplate&gt;
                  &lt;Border&gt;
                      &lt;Rectangle SnapsToDevicePixels="true" Margin="0" Stroke="Black" StrokeDashArray="1 2" StrokeThickness="1" /&gt;
                  &lt;/Border&gt;
              &lt;/ControlTemplate&gt;
          &lt;/Setter.Value&gt;
      &lt;/Setter&gt;
  &lt;/Style&gt;
  </code></pre>
  
  <p>ListBox in XAML:</p>
  
  <pre><code>&lt;ListBox Grid.Row="2" x:Name="list_category" Background="Transparent"  ItemsSource="{Binding Tables[0]}"  VerticalContentAlignment="Stretch"  &gt;
      &lt;ListBox.Resources&gt;
          &lt;SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}"/&gt;
          &lt;SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}" Color="Black"/&gt;
          &lt;SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="#00FFFFFF"/&gt;
      &lt;/ListBox.Resources&gt;
      &lt;ListBox.ItemTemplate&gt;
          &lt;DataTemplate&gt;
              &lt;GroupBox Header="Сопровождающие" Width="300"  VerticalAlignment="Stretch" VerticalContentAlignment="Stretch"  HorizontalAlignment="Stretch" x:Name="GroupBox" Background="Transparent"&gt;
                  &lt;DockPanel Tag="{Binding id_Person}"  VerticalAlignment="Stretch"&gt;
                      &lt;Button Click="Button_Click" DockPanel.Dock="Top"&gt;
                          &lt;Button.Content&gt;
                              &lt;DockPanel VerticalAlignment="Stretch"&gt;
                                  &lt;StackPanel DockPanel.Dock="Top" Orientation="Horizontal" HorizontalAlignment="Center"&gt;
                                      &lt;TextBlock Text="{Binding surname}" Padding="5"  HorizontalAlignment="Center"  Foreground="#FFB51414" /&gt;
                                      &lt;TextBlock Text="{Binding name}" Padding="5"  HorizontalAlignment="Center"  Foreground="#FFB51414" /&gt;
                                      &lt;TextBlock Text="{Binding lastname}" Padding="5"  HorizontalAlignment="Center"  Foreground="#FFB51414" /&gt;
                                  &lt;/StackPanel&gt;
                                  &lt;Grid DockPanel.Dock="Bottom"&gt;
                                      &lt;Grid.RowDefinitions&gt;
                                          &lt;RowDefinition /&gt;
                                          &lt;RowDefinition /&gt;
                                      &lt;/Grid.RowDefinitions&gt;
                                      &lt;Grid.ColumnDefinitions&gt;
                                          &lt;ColumnDefinition /&gt;
                                          &lt;ColumnDefinition /&gt;
                                          &lt;ColumnDefinition /&gt;
                                          &lt;ColumnDefinition /&gt;
                                          &lt;ColumnDefinition /&gt;
                                      &lt;/Grid.ColumnDefinitions&gt;
  
                                      &lt;TextBlock Text="{Binding quarter}" x:Name="quarter" Padding="5" Grid.Column="2"  Grid.Row="1" HorizontalAlignment="Center"  Foreground="#FFB51414" /&gt;
                                      &lt;TextBlock Text="{Binding halfyear}" x:Name="halfyear" Padding="5" Grid.Column="3" Grid.Row="1"  HorizontalAlignment="Center"  Foreground="#FFB51414" /&gt;
                                      &lt;TextBlock Text="{Binding year}" x:Name="year" Padding="5" Grid.Column="4"  Grid.Row="1" HorizontalAlignment="Center"  Foreground="#FFB51414" /&gt;
  
                                      &lt;TextBlock Text="Период: " Padding="5" Grid.Column="1"    HorizontalAlignment="Center"  Foreground="#FFB51414" /&gt;
  
                                      &lt;TextBlock Text="Квартал" Padding="5" Grid.Column="2"   HorizontalAlignment="Center"  Foreground="#FFB51414" /&gt;
                                      &lt;TextBlock Text="Полгода" Padding="5" Grid.Column="3"   HorizontalAlignment="Center"  Foreground="#FFB51414" /&gt;
                                      &lt;TextBlock Text="Год" Padding="5" Grid.Column="4"  HorizontalAlignment="Center"  Foreground="#FFB51414" /&gt;
                                      &lt;TextBlock Text="Цена: " Padding="5" Grid.Row="1"  Grid.Column="1"  HorizontalAlignment="Center"  Foreground="#FFB51414" /&gt;
                                  &lt;/Grid&gt;
  
  
                                  &lt;Grid DockPanel.Dock="Top" MinHeight="180" MaxHeight="180"&gt;
                                      &lt;Image Source="{Binding photo}"/&gt;
                                  &lt;/Grid&gt; 
                              &lt;/DockPanel&gt;
                          &lt;/Button.Content&gt;
                      &lt;/Button&gt;
                      &lt;Button DockPanel.Dock="Bottom" x:Name="send_mess" Tag="{Binding id_Person}" Click="send_mess_Click" Content="Написать сопровождающему"/&gt;
                      &lt;DockPanel DockPanel.Dock="Bottom" HorizontalAlignment="Center" Tag="{Binding id_Person}" &gt;
                          &lt;ComboBox VerticalAlignment="Top" x:Name="combobox_term"&gt;
                              &lt;ComboBoxItem Content="Квартал" Tag="1"/&gt;
                              &lt;ComboBoxItem Content="Полгода" Tag="2"/&gt;
                              &lt;ComboBoxItem Content="Год" Tag="3" IsSelected="True"/&gt;
                          &lt;/ComboBox&gt;
                          &lt;CheckBox Checked="CheckBox_Checked" Unchecked="CheckBox_Unchecked" IsChecked="{Binding id_Person, Converter={StaticResource CheckBoxToCheked}}" Content="Выбрать" /&gt;
                      &lt;/DockPanel&gt;
  
                  &lt;/DockPanel&gt;
              &lt;/GroupBox&gt;
          &lt;/DataTemplate&gt;
      &lt;/ListBox.ItemTemplate&gt;
  &lt;/ListBox&gt;
  </code></pre>