I have a Listbox displaying data, with a small border separating each item. The problem is that I only want a border between items, not at the top or bottom of the list. I figured that if I can retreive the first ListBoxItem in the list I can set it's border's thickness to 0.0, meaning that the borders only appear inbetween list items.
<ListBox Name="PerformanceList" ItemsSource="{Binding JFifoCollection}" HorizontalContentAlignment="Stretch">
<ListBox.ContextMenu>
<ContextMenu>
<MenuItem Name="ClearPerf" Click="MenuItem_Click" Header="Clear" />
</ContextMenu>
</ListBox.ContextMenu>
<ListBox.ItemTemplate>
<DataTemplate>
<Border BorderThickness="0,1,0,0" BorderBrush="#ff000099">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="100" />
<ColumnDefinition Width="100" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<TextBlock Text="{Binding Path=tid}" Grid.Column="0" Grid.RowSpan="6" FontSize="65pt" VerticalAlignment="Center" />
<TextBlock Grid.Column="1" Grid.Row="0" FontWeight="Bold">hwcrc</TextBlock>
<TextBlock Text="{Binding Path=HWCRC}" Grid.Column="2" Grid.Row="0" />
<TextBlock Grid.Column="1" Grid.Row="1" FontWeight="Bold">frame count</TextBlock>
<TextBlock Text="{Binding Path=Frames}" Grid.Column="2" Grid.Row="1" />
<TextBlock Grid.Column="1" Grid.Row="2" FontWeight="Bold">fps</TextBlock>
<TextBlock Text="{Binding Path=FPS}" Grid.Column="2" Grid.Row="2" />
<TextBlock Grid.Column="1" Grid.Row="3" FontWeight="Bold">faults</TextBlock>
<TextBlock Text="{Binding Path=Faults}" Grid.Column="2" Grid.Row="3" />
<TextBlock Grid.Column="1" Grid.Row="4" FontWeight="Bold">info</TextBlock>
<TextBlock Text="{Binding Path=Info}" Grid.Column="2" Grid.Row="4" />
<TextBlock Grid.Column="1" Grid.Row="5" FontWeight="Bold">config</TextBlock>
<TextBlock Text="{Binding Path=Config}" Grid.Column="2" Grid.Row="5" />
</Grid>
</Border>
<DataTemplate.Triggers>
</DataTemplate.Triggers>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
Is it possible to do this?