Note that there are some explanatory texts on larger screens.

plurals
  1. POWindows Phone 8 httpClient XML only returns one result to List
    primarykey
    data
    text
    <p>So Basically im running the code below, and all im getting is one item. I have checked the XML response and that contains more items than what I got. I have no idea why this is happening. </p> <p>Heres a screenshot <a href="https://iwjdgg.dm2301.livefilestore.com/y2phdGc9JO8hAazqzQkqmLkYAYb7ddQeXtfVHNtM0qSdsjet-zSnM6aQSDpKJEZMhz0SWc-kW8GE24BFCnqXrRhFCjVoThAMdunyRAGugMsd5A/wp_ss_20131114_0001.png" rel="nofollow">app prntscreen</a></p> <p>here is the way the XML response is setup <a href="http://www.hotukdeals.com/rest-api/docs" rel="nofollow">HotUKDeals API xml</a> </p> <pre><code> private void MainPage_Loaded(object sender, RoutedEventArgs e) { getResult(); } private async void getResult() { progressBar1.IsIndeterminate = true; progressBar1.Visibility = Visibility.Visible; string strRequestUri = "http://api.hotukdeals.com/rest_api/v2/?key=MY_API_KEY_GOES_HERE&amp;deals&amp;results_per_page=10&amp;page=1"; string strResult = string.Empty; try { HttpClient httpClient = new HttpClient(); try { strResult = await httpClient.GetStringAsync(strRequestUri); // GetByteArrayAsync //byte[] data = await httpClient.GetByteArrayAsync(strRequestUri); //strResult = data.Length.ToString(); progressBar1.IsIndeterminate = true; progressBar1.Visibility = Visibility.Visible; } catch (Exception ex) { strResult = ex.Message; } } catch (Exception ex) { strResult = ex.Message; } finally { // Show the result. this.Dispatcher.BeginInvoke(delegate() { //tbResult.Text = strResult; XElement wc = XElement.Parse(strResult); var postList = from deal in wc.Descendants("deals") select new Deals { dealimage = deal.Element("api_item").Element ("deal_image").Value,// tweet.Element("user").Element("profile_image_url").Value, dealimageHR = deal.Element("api_item").Element ("deal_image_highres").Value, Title = deal.Element("api_item").Element ("title").Value, //tweet.Element("user").Element("screen_name").Value, MobLink = deal.Element("api_item").Element ("mobile_deal_link").Value, MadeHot = deal.Element("api_item").Element ("hot_time").Value, dealtemp = deal.Element("api_item").Element ("temperature").Value, PostBy = deal.Element("api_item").Element ("poster_name").Value, ShopName = deal.Element("api_item").Element ("merchant").Element("name").Value, submited = Convert.ToString(deal.Element ("api_item").Element("submit_time").Value).Substring(0, 20) }; dealsListbox.ItemsSource = postList.ToList(); }); } } private void refreshBTN_Click(object sender, RoutedEventArgs e) { getResult(); } } } </code></pre> <p>Here is the MainPage.xaml</p> <pre><code> &lt;Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0"&gt; &lt;phone:LongListSelector Name="dealsListbox" Width="480" Height="719" VerticalAlignment="Bottom" Padding="0,0,0,95" Margin="-12,0" &gt; &lt;/phone:LongListSelector.Background&gt; &lt;phone:LongListSelector.ItemTemplate&gt; &lt;DataTemplate&gt; &lt;StackPanel Orientation="Horizontal" Margin="5,5,5,0" Background="#FF636363"&gt; &lt;StackPanel Width="125"&gt; &lt;Image Source="{Binding dealimageHR}" Height="115" Width="120" VerticalAlignment="Center" Margin="5,5,0,0" Stretch="UniformToFill" /&gt; &lt;TextBlock Text="{Binding dealtemp}" Foreground="OrangeRed" FontSize="27" FontWeight="Bold" HorizontalAlignment="Left" Margin="5,0,5,5" /&gt; &lt;/StackPanel&gt; &lt;StackPanel Width="340" Margin="8,5,0,0"&gt; &lt;TextBlock Text="{Binding Title}" Foreground="Orange" TextWrapping="Wrap" FontSize="22" FontWeight="SemiBold" HorizontalAlignment="Left" VerticalAlignment="Top" Height="98" Padding="0,0,1,0" /&gt; &lt;!--&lt;TextBlock Text="{Binding Description}" Foreground="DarkGray" FontSize="18" TextWrapping="Wrap" Margin="0,5,0,10" /&gt;--&gt; &lt;!--&lt;TextBlock Text="{Binding MobLink}" Foreground="Azure" FontSize="18" TextWrapping="Wrap" Margin="0,5,0,10" /&gt;--&gt; &lt;TextBlock FontSize="16" FontWeight="Light" Foreground="Red" &gt; &lt;Run Text="Posted"/&gt; &lt;Run Text="{Binding submited}" /&gt; &lt;Run Text="by:"/&gt; &lt;Run Text="{Binding PostBy}" /&gt; &lt;/TextBlock&gt; &lt;TextBlock Foreground="GreenYellow"&gt; &lt;Run Text="Made Hot" /&gt; &lt;Run Text="{Binding MadeHot}" FontWeight="Bold"/&gt; &lt;/TextBlock&gt; &lt;/StackPanel&gt; &lt;/StackPanel&gt; &lt;/DataTemplate&gt; &lt;/phone:LongListSelector.ItemTemplate&gt; &lt;/phone:LongListSelector&gt; </code></pre> <p>and the DealsClass.cs</p> <pre><code>class Deals { public string Title { get; set; } public string dealimage { get; set; } public string Description { get; set; } public string submited { get; set; } public string dealtemp { get; set; } public string MobLink { get; set; } public string dealimageHR { get; set; } public string MadeHot { get; set; } public string PostBy { get; set; } } </code></pre>
    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