I have an array of System.Windows.Controls.Image and I assign it to ListBox.ItemsSource.
What's more, I want to have a Border around each Image.
The xaml below demonstrates my idea.
<ListBox>
<ListBox.ItemTemplate>
<DataTemplate>
<Border BorderThickness="2" Style="{StaticResource borderStyle}"
Child="{Binding}"/>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
As you know, Child is not a dependency property; the code won't work.
So how should I put the Image (or the ListBox item) in the template?
A
ContentControlshould do the trick: