Note that there are some explanatory texts on larger screens.

plurals
  1. POParsing xml ListBoxs with WP7
    text
    copied!<p>I'm working on an application that shows for everyday a list of shows for a certain Tv channel. My problem is that the xml from which i'm extracting my data has the form below, and i want my Phone page to display the days'names (mon,tue,thu,fri...) in the top and below the list of programs for the selected day. I want to read all the "date" and "item" at the same time, but all i can read is all "date" or all "item" but not both at the same time ( i used the methods below): c#: "item" ` var items = from item in doc.Elements("programme").Descendants("item")</p> <pre><code> select new ProgData { Time = item.Element("heure").Value, Title = item.Element("title").Value, Photo = item.Element("image").Value, Description = ((item.Element("description").Value).Length &gt; maxLength ? (item.Element("description").Value).Substring(0, maxLength) : (item.Element("description").Value)), }; ProgsListBox.ItemsSource = items;` </code></pre> <p>"date":</p> <pre><code> var items = from c in doc.Elements("programme").Descendants("jour") select new Week() { Day = c.Attribute("date").Value, Date = (DateTime.Parse(c.Attribute("date").Value)).DayOfWeek, }; ListBoxDays.ItemsSource = items; </code></pre> <p>xml:</p> <pre><code>&lt;programs&gt; &lt;day date="04/01/2012"&gt; &lt;item&gt; &lt;id&gt;1&lt;/id&gt; &lt;title&gt;PROGRAM ONE&lt;/title&gt; &lt;image&gt; http://www.tvchannel.tv/uploads/show/thumbnails_iphone/programone-copy.png &lt;/image&gt; &lt;description&gt; &lt;![CDATA[ Infos about my show ]]&gt; &lt;/description&gt; &lt;corps&gt; &lt;![CDATA[ Just more infos about my show ]]&gt; &lt;![CDATA[more and more infos]]&gt; &lt;/corps&gt; &lt;heure&gt;00:00&lt;/heure&gt; &lt;link/&gt; &lt;/item&gt; &lt;item&gt; &lt;id&gt;2&lt;/id&gt; &lt;title&gt;PROGRAM TWO&lt;/title&gt; &lt;image&gt; http://www.tvchannel.tv/uploads/show/thumbnails_iphone/progratwo-copy.png &lt;/image&gt; &lt;description&gt; &lt;![CDATA[ Infos about my show ]]&gt; &lt;/description&gt; &lt;corps&gt; &lt;![CDATA[ Just more infos about my show ]]&gt; &lt;![CDATA[more and more infos]]&gt; &lt;/corps&gt; &lt;heure&gt;06:00&lt;/heure&gt; &lt;link/&gt; &lt;/item&gt; &lt;/day&gt; &lt;day date="05/01/2012"&gt; &lt;item&gt; &lt;id&gt;1&lt;/id&gt; &lt;title&gt;PROGRAM ONE&lt;/title&gt; &lt;image&gt; http://www.tvchannel.tv/uploads/show/thumbnails_iphone/programone-copy.png &lt;/image&gt; &lt;description&gt; &lt;![CDATA[ Infos about my show ]]&gt; &lt;/description&gt; &lt;corps&gt; &lt;![CDATA[ Just more infos about my show ]]&gt; &lt;![CDATA[more and more infos]]&gt; &lt;/corps&gt; &lt;heure&gt;00:00&lt;/heure&gt; &lt;link/&gt; &lt;/item&gt; &lt;item&gt; &lt;id&gt;2&lt;/id&gt; &lt;title&gt;PROGRAM TWO&lt;/title&gt; &lt;image&gt; http://www.tvchannel.tv/uploads/show/thumbnails_iphone/progratwo-copy.png &lt;/image&gt; &lt;description&gt; &lt;![CDATA[ Infos about my show ]]&gt; &lt;/description&gt; &lt;corps&gt; &lt;![CDATA[ Just more infos about my show ]]&gt; &lt;![CDATA[more and more infos]]&gt; &lt;/corps&gt; &lt;heure&gt;06:00&lt;/heure&gt; &lt;link/&gt; &lt;/item&gt; &lt;/day&gt; </code></pre> <p></p> <p>Phone Page: <img src="https://i.stack.imgur.com/lL3FO.png" alt="The expected resul"></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload