Possible Duplicate:
Using binding to a List<UserControl> how can I do for not showing the controls
I have a problem with ItemTemplate for a ListBox
<TextBlock TextWrapping="Wrap" Text="{Binding Objective}" Grid.Column="0" VerticalAlignment="Center" FontWeight="Bold" />
<ItemsControl ItemsSource="{Binding Problems}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Rectangle Stroke="Black" Height="20" Width="20" Margin="1,0" />
</DataTemplate>
</ItemsControl.ItemTemplate>
This is the that receives ItemsSource in ListBox:
ItemsSource to listBox. It contains:
List<Container>
(Below container properties)
- Objective: string
- Problems: List
The problem in Problems property, when the program loads, it tells me this error:
System.Windows.Data Error: 26 : ItemTemplate and ItemTemplateSelector are ignored for items already of the ItemsControl's container type;
I'm a basic developer in WPF, and I have no idea to solve this problem. One person tells me that I might use a wrap panel.. but maybe there's be another alternative.