You can specify ItemTemplatespecifically for your ListBox:
<ListBox>
<ListBox.ItemTemplate>
<DataTemplate>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
, , DataTemplate ResourceDictionary -:
<DataTemplate x:Key="MyTemplate">
</DataTemplate>
ListBox, :
<ListBox ItemTemplate="{StaticResource MyTemplate}" />
DataTemplate ( , String) :
<Window x:Class="WpfApplication1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
Title="MainWindow" Height="350" Width="525">
<Window.Resources>
<DataTemplate DataType="{x:Type sys:String}">
<Rectangle Height="10" Width="10" Margin="3" Fill="Red" />
</DataTemplate>
</Window.Resources>
<Grid>
<ListBox>
<ListBox.ItemTemplate>
<DataTemplate>
<Rectangle Height="10" Width="10" Margin="3" Fill="Blue" />
</DataTemplate>
</ListBox.ItemTemplate>
<sys:String>One</sys:String>
<sys:String>Two</sys:String>
<sys:String>Three</sys:String>
</ListBox>
</Grid>
</Window>
:
