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.