Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><strong>UPDATE</strong> I dug deeper into this. First of all, it makes no sense to me to order items by categories just because every item has more than one category. As you indicated below, you were interested in filtering. Here is how I did that (the code goes into the UpdateFeedList event):</p> <pre><code>//same code as in the example SyndicationFeed feed = SyndicationFeed.Load(xmlReader); //I pull out the distinct list of categories from the entire feed //You might want to bind this list to a dropdown on your app //so that users can select what they want to see: List&lt;string&gt; cats = new List&lt;string&gt;(); foreach (SyndicationItem si in feed.Items) foreach(SyndicationCategory sc in si.Categories) if (!cats.Contains(sc.Name)) cats.Add(sc.Name); //Here I imagined that I want to see all items categorized as "Trendy" SyndicationCategory lookingFor = new SyndicationCategory("Trendy"); //and I create a container where I could copy all "Trendy" items: List&lt;SyndicationItem&gt; coll = new List&lt;SyndicationItem&gt;(); //And then I start filtering all items by the selected tag: foreach (SyndicationItem si in feed.Items) { foreach (SyndicationCategory sc in si.Categories) if (sc.Name == lookingFor.Name) { coll.Add(si); break; } } Deployment.Current.Dispatcher.BeginInvoke(() =&gt; { // Bind the filtered of SyndicationItems to our ListBox. feedListBox.ItemsSource = coll; loadFeedButton.Content = "Refresh Feed"; }); </code></pre> <p><strong>WHATEVER BELOW IS INCORRECT</strong></p> <pre><code>yoursyndicationfeed.Categories.Sort() </code></pre> <p>I personally would not be sorting an RSS feed by anything except for the date descending (it should be sorted so already) because an RSS feed gives me the updates for the web site content in the reverse order of them being published and that I how most people are used to see it :)</p> <p>Another update (also incorrect :))</p> <p>Ok, so I still don't have the code for that app in front of me, but digging around documentation (that I mentioned in the comments), here is what you can do:</p> <pre><code>SyndicationFeed feed = SyndicationFeed.Load(xmlReader); feed.Items.OrderBy(x =&gt; x.Category); </code></pre> <p>The idea is that feed.Items is a List of your elements. So treat it like a list, sort it by the property that you need.</p> <p>Oh, also, I saw your other question on the RSS reader, do you have to use the sample? Scott Guthrie <a href="http://weblogs.asp.net/scottgu/archive/2010/03/18/building-a-windows-phone-7-twitter-application-using-silverlight.aspx" rel="nofollow">wrote an RSS client for Windows Phone 7</a>, his implementation seems a bit simpler. It depends on your needs, of course.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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