0

我正在開發一個應用程序與設置爲我的目標版本7.1版本的Windows手機。我遇到的問題是我的頁面中的一個列表視圖拒絕顯示。模擬器提供不同的結果

我已經調試過,以確保列表中的內容被解析。此外,應用程序運行良好,當我使用Windows 8模擬器。但是,在應用程序的其他頁面中填充其他列表視圖時使用的相同技術在所有不顯示此單頁的模擬器上都能正常工作。

我甚至試圖設置綁定堆棧面板的顏色,看看它是否會顯示,它確實沒有任何內容。 我真的很困惑,我的代碼非常完美。我想知道有沒有人用windows phone模擬器看過這個問題?

private void countdownClient_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e) 
    { 
     HtmlDocument doc = new HtmlDocument();    
     if (e.Error != null) 
     { 
      //MessageBox.Show(e.Error.InnerException.Message + "\n Ensure You Have A Working Internet Connection");     
      return; 
     } 
     doc.LoadHtml(e.Result); 
     String noCountdown = "<div><span>Sorry no buses are expected within 30 minutes of this stop. Please try again later or go to www.tfl.gov.uk</span></div>"; 

     if (e.Result.Contains(noCountdown)) 
     { 
      //No Buses Expected; 
      return; 
     } 
     else 
     { 
      HtmlNode stopCountdownNode; 
      try 
      { 
       stopCountdownNode = doc.DocumentNode.SelectSingleNode("//*[contains(@id, 'stopBoard')]").SelectSingleNode("tbody"); 
      } 
      catch (Exception) 
      { 
       MessageBox.Show("Error Responce From Server"); 
       return; 
      } 

      if (stopCountdownNode != null) 
      { 
       HtmlNodeCollection countdownNodeList = stopCountdownNode.SelectNodes("tr"); 
       CountDownListBox.ItemsSource = GetCountdownList(countdownNodeList); 
      } 
     } 
    } 

    private ObservableCollection<BusCountdown> GetCountdownList(HtmlNodeCollection countdownNodeList) 
    { 
     ObservableCollection<BusCountdown> countdownList = new ObservableCollection<BusCountdown>(); 
     foreach (HtmlNode countDown in countdownNodeList) 
     { 
      String busName = HttpUtility.HtmlDecode(countDown.SelectSingleNode("*[contains(@class, 'resRoute')]").InnerHtml); 
      String busDestination = HttpUtility.HtmlDecode(countDown.SelectSingleNode("*[contains(@class, 'resDir')]").InnerHtml); 
      String countDownTime = HttpUtility.HtmlDecode(countDown.SelectSingleNode("*[contains(@class, 'resDue')]").InnerHtml); 
      countdownList.Add(new BusCountdown(busName, busDestination, countDownTime));  
     }              
     return countdownList; 
    } 

    public string GetRandomSlash() 
    { 
     Random r = new Random(); 
     String slash = ""; 
     int rand = r.Next(1, 20); 
     for (int i = 0; i < rand; i++) 
     { 
      slash += "/"; 
     } 
     return slash; 
    } 

回答

1

試着設置你的類訪問說明符,你用它來綁定到公共並試一試。讓我知道它是否有效。

對於前:

public class Bindingclass 
{ 
public string Name{get;set;} 
} 
+0

所有綁定屬性已經公開,如果不是他們不會工作。 –

+0

屬性默認爲公共。如果沒有,它不會在任何地方工作......你已經定義了一個類的屬性嗎?讓這個班級公開... \ – Mani

+0

哦,是的,馬克斯現在工作了。你說的對,我以前的課都有公開的Rfix,除此之外。爲什麼?我不知道大聲笑。 Thanx –

0
  1. 嘗試使用Expression Blend的,並刪除之前的解決方案文件,並建立一個新的解決方案
  2. 還爲所有頁面正確設置了構建操作屬性。
  3. 將您的SDK更新到7.8版本。您將獲得多個仿真器選擇 - 仿真器7.1(256 MB),仿真器7.1(512 MB),仿真器7.8(256 MB),仿真器7.8(512 MB)。在所有這些版本上測試它並檢查每個仿真器類型的輸出。

我希望至少有一個這樣可以幫助你讓事情順利進行。讓我們知道。

+0

我正在使用Windows 8 sdk不能走得更高,它在所有模擬器上工作正常,只有一個頁面不能在win 7.1模擬器上工作。有趣的是,在同一個7.1模擬器上的前一頁使用了相同的顯示技術,它的工作原理完美無瑕。 –

+0

分享您的代碼夥伴以獲取更多信息。 –

+0

立即查看@rjBombil –

相關問題