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:
- How to use a run-time collection with the XAML code
- How to reference the collection item in the XAML
- 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!
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