tags:

views:

377

answers:

2

I have a program which has some Textareas / Labels these can be anywhere on the Window and in any order - however I want to assign them values from a List, Collection or Array so I want one label to read MyCollection(1) and another MyCollection(2) and so on - they are not always together or in the same order so a ListBox is no good - how do you build a collection in code e.g. VB.NET and then give each label the reference for the Item index I want it to show.

Main questions are:

  1. How to use a run-time collection with the XAML code
  2. How to reference the collection item in the XAML
  3. List item

How to do this so can read in any order eg read index 4, then 2 then 1

I am stuck on how to proceed!

A: 

i am not sure that i understand the question completely - but from my understanding i will try to answer

so you have a some labels and textareas on the window and at run time you want them to pull the information (one item) from a colleciton and display. in the code behind file (.xaml.cs) file can you use linq and get the lable control and then from the collection find the value and assign

you can create an object at runtime andbind your controls to this oject - provide a IConverter implementation to bind to the correct value

A: 

That sounds interesting - so I find the label I want and then assign the value of it from the Collection for example have the Label with the Tag or similar "1", and then use code to find the Label with this Name/Tag and assign it the first item from the array - never thought of that - this may do. The other solution to provide an IConverter implementation I don't understand however I can at least do the first!

Thanks - if anyone else has any other ideas - maybe someone else out there needs something like this.

RoguePlanetoid