title: WPF - Custom Style for ItemsControl
body: <p>I would like to have the following layout:
  <a href="https://i.stack.imgur.com/dmPQp.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/dmPQp.jpg" alt="enter image description here" /></a></p>
  <p>This is my approach. I am looking for an elegant solution to position the triangle and numbers on the left and integrate the two vertical lines.
  Also, the background of the active element should go over the whole length.
  <a href="https://i.stack.imgur.com/zcfZN.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zcfZN.jpg" alt="enter image description here" /></a></p>
  <pre><code>&lt;Window x:Class=&quot;MainWindow&quot;
          xmlns=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;
          xmlns:x=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;
          xmlns:d=&quot;http://schemas.microsoft.com/expression/blend/2008&quot;
          xmlns:mc=&quot;http://schemas.openxmlformats.org/markup-compatibility/2006&quot;
          xmlns:entries=&quot;clr-namespace:Test.WPF.TreeView.Entries&quot;
          xmlns:conveter=&quot;clr-namespace:Test.WPF.TreeView.Converter&quot;
          mc:Ignorable=&quot;d&quot;
          Title=&quot;MainWindow&quot; Height=&quot;450&quot; Width=&quot;800&quot;&gt;
      &lt;Window.Resources&gt;
          &lt;BooleanToVisibilityConverter x:Key=&quot;BooleanToVisibilityConverter&quot;/&gt;
          &lt;conveter:IsRunningToColorConverter x:Key=&quot;IsRunningToColorConverter&quot;/&gt;
      &lt;/Window.Resources&gt;
      &lt;Grid&gt;
          &lt;ItemsControl ItemsSource=&quot;{Binding Entries, Mode=OneWay}&quot;&gt;
              &lt;ItemsControl.Resources&gt;
                  &lt;DataTemplate DataType=&quot;{x:Type entries:Job}&quot;&gt;
                      &lt;StackPanel Orientation=&quot;Horizontal&quot; Margin=&quot;12 0 0 0&quot; Background=&quot;{Binding IsRunning, Converter={StaticResource IsRunningToColorConverter}, Mode=OneWay}&quot;&gt;
                          &lt;Polygon Margin=&quot;0 0 5 0&quot; Points=&quot;0,0 8,7, 0,14&quot; Fill=&quot;Black&quot; Visibility=&quot;{Binding IsRunning, Converter={StaticResource BooleanToVisibilityConverter}, Mode=OneWay}&quot;/&gt;
                          &lt;TextBlock Text=&quot;{Binding Name, Mode=OneWay}&quot; Margin=&quot;0&quot;/&gt;
                      &lt;/StackPanel&gt;
                  &lt;/DataTemplate&gt;
                  &lt;DataTemplate DataType=&quot;{x:Type entries:Iteration}&quot;&gt;
                      &lt;StackPanel Orientation=&quot;Vertical&quot; Margin=&quot;12 0 0 0&quot;&gt;
                          &lt;TextBlock&gt;&lt;Run Text=&quot;{Binding Count, Mode=OneWay}&quot; FontWeight=&quot;Bold&quot;/&gt;  Loop (&lt;Run Text=&quot;{Binding Name, Mode=OneWay}&quot;/&gt;)&lt;/TextBlock&gt;
                          &lt;ItemsControl ItemsSource=&quot;{Binding Entries, Mode=OneWay}&quot;/&gt;
                      &lt;/StackPanel&gt;
                  &lt;/DataTemplate&gt;
              &lt;/ItemsControl.Resources&gt;
          &lt;/ItemsControl&gt;
      &lt;/Grid&gt;
  &lt;/Window&gt;
  </code></pre>