tags:

views:

52

answers:

2

How to repeat a UI in WPF. I mean if I have dynamic records, and I want to display a UI block with labels and textboxes and other controls for each record how do I do that?

All my data on the window is dynamic, nothing is static,

 Record 1 in database:        test1 test11 
                         d1     t1   t11
                         r1     m1   m11

 Record 2 in database:        test2  test22 test222
                         d2     t2     t22    t222
                         r2     m2     m22    m222
                         k2     k2     k22    k222

I have a big object TEST with all this values eg, test1, test11, d1, r1, t1, t11, m1, m11, etc. All the rows and columns are dynamic. How will I create an UI for the above requirement. I am sorry if this is not clear and is too confusing to understand.

+6  A: 

This is pretty vague, so the answers will follow suit.

Generically, you use an ItemsControl (or one if its inheritors) and set its ItemsSource property to the collection of records.
You define a DataTemplate with everything needed to display a single record.
You assign that DataTemplate as the ItemsControl's ItemTemplate.

Jay
@developer. Jay is right on the money but you may need to 'play' with what he's said a bit before it really makes sense to you. [Dr WPF](http://drwpf.com/blog/category/itemscontrol/) has the best free tutorial I have seen for something like this. Cheers
Berryl
+1  A: 

Use an ItemsControl add the the controls to the ItemsControl's ItemTemplate

Wallstreet Programmer