0
votes

I have a custom control I created from a expression design I created and exported to xaml. I have put in it a bound itemtemplate/datatemplate of a ListBox contorl. It doesn't seem to be rendering more than once and/or it is rendering each item in the same place(kind of like the same x,y coordinates.

It would seem to me that this should be a simple process. If I fill the datatemplate with a textblock it would generate a couple textblocks in a vertical list. I would expect if I swap out the textblock with my custom control I should get a couple custom controls in a vertical list.

Wouldn't this be teh expected behavior or is there a reason the listbox only appears to be rendering a single usercontrol? In both cases I use the same data for the listbox.

<telerik:ListBox x:Name="PeopleList"  Grid.Row="1" >
        <telerik:ListBox.ItemTemplate>
            <DataTemplate>
                <Grid>

                    <custom:ExecSelector Height="100" Width="100"  x:Name="ExecSelector" FullName="{Binding City}"></custom:ExecSelector>                

                </Grid>    

            </DataTemplate>
        </telerik:ListBox.ItemTemplate>
    </telerik:ListBox>


 People = new List<PersonViewModel>();
        PersonViewModel person2 = new PersonViewModel()
        {
            Name = "Austin Weise",
            City = "Texas",
            Email = "[email protected]",
            Position = "Techincal Director",
            Bio = "Programmer"
        };
        PersonViewModel person = new PersonViewModel()
        {
            Name = "Ian House",
            City = "Vancouver",
            Email = "[email protected]",
            Position = "Creative Director",
            Bio = "Designer"
        };

        People.Add(person2);            
        People.Add(person);

        PeopleList.DataContext = this;
        PeopleList.ItemsSource = People;

That should provide enough to visualize it unless the UI elements are required for the custom control.

1
What is your question please, be specific!VoodooChild

1 Answers

0
votes

Based on your current description of your problem:

  • make sure you have not put any values on the Top and Left properties of the outer control.
  • make sure you have more than one data item in the list you are binding to
  • make sure your ListBox has sufficient height to be able to show more than one item
  • make sure you haven't disabled the ListBox scroll bar.

That's all the guesses that i can throw out there unless you have more details.