我正在开发一个应用程序与设置为我的目标版本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 –