title: WP8 working with XML and LongListSelector
body: <p>I'm trying to make a LongListSelector from xml file data.</p>
  
  <pre><code>public MainPage()
      {
          InitializeComponent();
  
          XDocument loadedData = XDocument.Load("/Resources/EuroTrip.xml");
  
          var data = from query in loadedData.Descendants("country")
                     select new Country
                     {
                         Name = (string)query.Element("name"),
                         IdentityCard = (string)query.Element("identityCard"),
                         CompulsoryDocuments = (string)query.Element("compulsoryDocuments"),
                         Regulations = (string)query.Element("regulations"),
                         Equipment = (string)query.Element("equipment"),
                         SpeedLimitsLightVehicles = (string)query.Element("speedLimitsLightVehicles"),
                         AutoClubs = (string)query.Element("autoClubs")
                     };
          countriesList.ItemsSource = data;
          // Set the data context of the listbox control to the sample data
          DataContext = App.ViewModel;
      }
  
      public class Country
  {
      string name;
      string identityCard;
      string compulsoryDocuments;
      string regulations;
      string equipment;
      string speedLimitsLightVehicles;
      string autoClubs;
  
      public string Name
      {
          get { return name; }
          set { name = value; }
      }
  
      public string IdentityCard
      {
          get { return identityCard; }
          set { identityCard = value; }
      }
  
      public string CompulsoryDocuments
      {
          get { return compulsoryDocuments; }
          set { compulsoryDocuments = value; }
      }
  
      public string Regulations
      {
          get { return regulations; }
          set { regulations = value; }
      }
  
      public string Equipment
      {
          get { return equipment; }
          set { equipment = value; }
      }
  
      public string SpeedLimitsLightVehicles
      {
          get { return speedLimitsLightVehicles; }
          set { speedLimitsLightVehicles = value; }
      }
  
      public string AutoClubs
      {
          get { return autoClubs; }
          set { autoClubs = value; }
      }
      }
  </code></pre>
  
  <p>I used this tutorial:
  <a href="http://www.geekchamp.com/tips/wp7-working-with-xml-reading-filtering-and-databinding" rel="nofollow">http://www.geekchamp.com/tips/wp7-working-with-xml-reading-filtering-and-databinding</a>
  but I got an error on this line:</p>
  
  <pre><code>            countriesList.ItemsSource = data;
  </code></pre>
  
  <p>The error says:</p>
  
  <blockquote>
    <p>An explicit conversion exists (are you missing a cast?)</p>
  </blockquote>
  
  <p>I think because the LongListSelector in WP7 and WP8 aren't using the same controls, but I don't know what I must change and I don't find any useful article about this.</p>
  
  <p>Thanks for your help:)</p>
  
  <p>EDIT: this is the xaml code where I would want to bind the data:</p>
  
  <pre><code>            &lt;!--Pivot item two--&gt;
          &lt;phone:PivotItem Header="Countries"&gt;
              &lt;!--Double line list no text wrapping--&gt;
              &lt;phone:LongListSelector IsGroupingEnabled="False" x:Name="countriesList" Margin="0,0,-12,0" ItemsSource="{Binding Items}"&gt;
                  &lt;phone:LongListSelector.ItemTemplate&gt;
                      &lt;DataTemplate&gt;
                          &lt;StackPanel Margin="0,0,0,17"&gt;
                              &lt;!--Image Width="60" Source="{Binding Photo}" Margin="12,6" HorizontalAlignment="Left"/--&gt;
                              &lt;TextBlock VerticalAlignment="Center" Text="{Binding LineOne}" TextWrapping="NoWrap" Margin="82,0,0,0" Style="{StaticResource PhoneTextExtraLargeStyle}" Foreground="Black"/&gt;
                              &lt;TextBlock VerticalAlignment="Center" Text="{Binding LineTwo}" TextWrapping="NoWrap" Margin="82,-6,0,0" Style="{StaticResource PhoneTextSubtleStyle}" Foreground="Black"/&gt;
                          &lt;/StackPanel&gt;
                      &lt;/DataTemplate&gt;
                  &lt;/phone:LongListSelector.ItemTemplate&gt;
              &lt;/phone:LongListSelector&gt;
          &lt;/phone:PivotItem&gt;
  </code></pre>