WPF creating dynamic rows using MVVM pattern -


I want to load my WPF UserControl with dynamic rows. My scenario is as follows.

  1 When UserControl is loaded, then I will list your list & lt; String & gt; With some values ​​the object that I will get from the database 2. I need to create equal numbers in my UserControl which list & lt; String & gt; Matches the number of items in thing.  

Column 1 is a label control and column 2 will contain a text block control

  label 1: item 1 (this is the list & lt; string & gt; ; Value of the object) Label 2: item 2 label 3: item 3 I know how to make the rows dynamically, but my problem is that when I am using MVVM pattern  

Note: I am using MVVM Toolkit from CodePlex.

Thank you, Jitu

As your data content of your UserControl you have MVVM Set the object, I hope that the object has a collection property then reduce the items down like control, it is not clear from your description that the labels and items that come from your viewldle are the code given below. Dynamically form rows in many forms as collection .

  & Item Items Controll ItemsSource = "{YourStringCollection Binding}" Horizontal Alignment = "Left" & gt; ItemsControl.ItemsPanel & gt; ItemsPanelTemplate & gt; ; & Gt; StackPanel Orientation = "Vertical" />  / ItemsPanelTemplate & gt; & gt; /ItemsControl.ItemsPanel> ItemControl.ItemsTemplate & gt; & lt; DataTemplate & gt; & lt; Text Block Text = "{Binding}" & gt; / DataTemplate & gt; & lt; / ItemsControl. ItemTemplate & gt; & lt; / ItemsControl & gt;  

Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -