我正在開發一個應用程序與設置爲我的目標版本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;
}
所有綁定屬性已經公開,如果不是他們不會工作。 –
屬性默認爲公共。如果沒有,它不會在任何地方工作......你已經定義了一個類的屬性嗎?讓這個班級公開... \ – Mani
哦,是的,馬克斯現在工作了。你說的對,我以前的課都有公開的Rfix,除此之外。爲什麼?我不知道大聲笑。 Thanx –