Repeating user controls in Silverlight using MVVM

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

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

Saran


Responses

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

Up
0
Down

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

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

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


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

Thank you for posting at Dotnetfunda
[Administrator]

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

Login to post response