0

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.

Community
  • 1
  • 1
Darf
  • 2,365
  • 5
  • 23
  • 36
  • Creating a new question with the [exact same content](http://stackoverflow.com/questions/7294993/using-binding-to-a-listusercontrol-how-can-i-do-for-not-showing-the-controls/7295064) because people either do not respond to comments right away or because you do not get any good answers for a few hours will not be tolerated. If you have clarifications to make, edit the question, tell people who gave insufficient answers and **wait**, if you still do not get an answer you may apply a bounty after some time. – H.B. Sep 03 '11 at 20:41
  • Also i never said anything about a WrapPanel, you should read more carefully. – H.B. Sep 03 '11 at 20:47
  • Not exactly the same, the other one contained a bit more code and details. Voting to close this one. – Henk Holterman Sep 03 '11 at 20:48
  • @HenkHolterman: Let me clarify, it's the exact same problem of the exact same user, which is more than enough to close this question ten times over. – H.B. Sep 03 '11 at 20:51
  • @H.B then why don't you? – Henk Holterman Sep 03 '11 at 20:53
  • @HenkHolterman: I flagged it as soon as i saw it, i tend to do that in those cases, also it's weekend so the required votes may not be reached and the question pushed out of sight (in this tag that is)... – H.B. Sep 03 '11 at 20:54

0 Answers0