The main problem is this one.
I have 2 XMLs containing information about what my company does. One is considered the template XML where you can find the general information and the other one is the Catalog containing information about each individual equipment, containing a reference to the template XML.
They look like this
Catalog XML
<list>
<A>
<B>
<c>reference to template</c>
<d>info 2</d>
<e>info 3</e>
<f>info 4</f>
<g>
<h>info5</h>
<i>info5</i>
</g>
</B>
<B>
<c>reference to template</c>
<d>info a</d>
<e>info s</e>
<f>info d</f>
<g>
<h>infof</h>
<i>infog</i>
</g>
</B>
<B>
<c>reference to template</c>
<d>info h</d>
<e>info j</e>
<f>info k</f>
<g>
<h>infot</h>
<i>infoy</i>
</g>
</B>
</A>
</list>
Template
<list>
<R>
<S>
<t>info 7</t>
<u>info 8</u>
<v>info 9</v>
<w>info 10</w>
</S>
</R>
</list>
What I need to do is to display all of the equipment catalogued in a listView, which will lits information from both XMLs.
I’ve tried that and had no succes, all I can display is one equipment, weel it actually isn’y displayed, all that appears is invisible information.
I run through both XMLs using this:
xDocument load = xDocument.load("Myxml.xml");
var run = (from x in load.Descendants("A")
where x.Element("c").Value == comboBox1.SelectedItems.ToString()
select new
{
a = x.Element("d").Valuye.ToString(),
//here I gather the rest of the information
}).ToList();
listView.Items.Add(run);
//after that I tried listview.Items.Add(run.a) ... but the code which I use to run through
//ends with FirstorDefault(), instead of ToList() and I try adding all the components manually
The only thing that Appears is an invisible Equipment, which means that when I click on it I can see there’s something there, but I just can’t see the information.
So I tried adding strings using the same methodology, but got the same result.
Can anyone please tell me where’s my mistake? I can’t see it.
PS: After I manage to do this, I’m gonna Implement a function, that by double clicking on the information, the client will be able to alter the information. If someone knows where to start with this one, please point me in the right direction
I found out what was wrong, I needed to add an observable collection, to which I added the content I wanted to put on the viewlist, and then I put the information in the observablecollection in the viewlist.
Thank you all for helping me.