title: Creating a Pivot in background code from Linq feed
body: <p>I've currently got a class that gets and dispatches an XML feed using Linq to XML to a ListBox in my XAML page. I took this from a tutorial, and was wondering, would I be able to make it appear in a pivot?</p>
  
  <p>My idea is to load the feed, and create a pivot page just in background code for each item (Something like, foreach item in my data, create a new pivot, with other content)</p>
  
  <p>Is this possible?
  I currently get data into a ListBox by Binding the loading and using "TextBlock Text="{Binding Id}"/>" in XAML, and loading the feed in the background code as follows:</p>
  
  <pre><code>myFeed.LoadFeed(//name of the listbox that currently has to exist in XAML)
  </code></pre>
  
  <p>Here is my code that loads the XML feed and dispatches to a Listbox</p>
  
  <pre><code>public class FeedItem
  {
      public string Id { set; get; }
      public string Text { set; get; }
  
  }
  
  public class Feed
  {
      ListBox myContext;
  
      public void LoadFeed(ListBox context)
      {
          myContext = context;
          HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(new Uri("http://myDataSource"));
          request.BeginGetResponse(new AsyncCallback(ReadCallback), request);
      }
  
  
      private static readonly XNamespace m = "http://schemas.microsoft.com/ado/2007/08/dataservices/metadata";
      private void ReadCallback(IAsyncResult asynchronousResult)
      {
  
  
          HttpWebRequest request =
              (HttpWebRequest)asynchronousResult.AsyncState;
          HttpWebResponse response =
            (HttpWebResponse)request.EndGetResponse(asynchronousResult);
          XDocument doc = XDocument.Load(response.GetResponseStream());
  
             List&lt;FeedItem&gt; feedItems = (from question in doc.Descendants(m + "properties")
                                          select new FeedItem()
                                          {
                                              Id = question.Descendants().ToList()[0].Value,
                                              Text = question.Descendants().ToList()[1].Value
                                          }).ToList();
  
              myContext.Dispatcher.BeginInvoke(() =&gt; { myContext.ItemsSource = feedItems; });
  
  
  
  
  
  
      }
  }
  </code></pre>
  
  <p>What can be used to hold the data so it can go in a pivot?
  How do i parse the response item-by-item, into a new pivot?</p>