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 –

相关问题