Repeating user controls in Silverlight using MVVM

Posted by Saranram under Silverlight on 2/21/2013 | Points: 10 | Views : 1919 | Status : [Member] | Replies : 1

I need to repeat user controls dynamically in Silverlight using MVVM. Based on the data count i have to display the controls repeated. For example If employee details have 10 counts then i need to repeat the control ten times. I have attached the needed output format.

Employee Details : XXXXX
Employee Age : 34

Employee Details : YYYY
Employee Age : 42



Posted by: Vuyiswamb on: 2/22/2013 [Member] [MVP] [Administrator] NotApplicable | Points: 25


use a listbox and format it the way you want , do something like this

  <ListBox ItemsSource="Viewmodel" Background="Wheat" Width="30">

<controls:WrapPanel Orientation="Horizontal" ></controls:WrapPanel>
<ControlTemplate TargetType="ListBox">
<Grid Background="{TemplateBinding Background}">
<ItemsPresenter />

Or you can use a Grid and add what ever you want in a TemplateColumn

Thank you for posting at Dotnetfunda

Saranram, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response