【问题标题】:C# WP7 Silverlight Repeater Not Working,C# WP7 Silverlight 中继器不工作,
【发布时间】:2010-11-23 10:01:47
【问题描述】:

大家好,我在尝试设置中继器时得到了一些帮助,但当我测试他的代码时,它仍然无法正常工作显示什么是什么,

我有一个 XML Feed,http://spiked.appware.co.uk/xml/comments/get/5/

然后将它们加载到对象内的变量中

comment[] Comments.comments

public class comment
{
   public string text = "";
   public string device = "";
   public string name = "";
   public string id = "";
}

我希望能够 foreach Comments.cmets 并将其传递给转发器,以便 XAML 重复内部的代码块,转发器并使用 {binding text} 作为文本框的值深度代码检查下面的链接

Data binding no error but the binding is not outputting

为了第一个答案

var comments = new Comments();
var threeComments = new List<Comment>
{
    new Comment("t1", "d1", "n1", "i1"),
    new Comment("t2", "d2", "n2", "i3"),
    new Comment("t3", "d3", "n3", "i3")
};
comments.comments = threeComments.ToArray();
commentsLooper.ItemsSource = new CommentsDataItems(comments); 

【问题讨论】:

  • 我不认为这个问题可以归结为一点,可以吗?您是否需要一些特定的功能来帮助您编写解决方案?
  • 这个问题只是stackoverflow.com/questions/4203471/…的重复吗?
  • 不,我要求任何工作示例,所以我可以重新创建以修复我的代码。

标签: c# silverlight xaml windows-phone-7


【解决方案1】:

你用什么做中继器?

您是否查看过默认的“DataBound”应用程序模板?这将使用数据绑定在 ListBox 中显示对象集合。
听起来您正在尝试做同样的事情,只有您的集合(数组)首先通过解析 XML 提要来填充。

编辑:
假设这个问题是Data binding no error but the binding is not outputting的延续@
我现在在http://cid-cc22250598bf7f04.office.live.com/self.aspx/Public/ShowCommentsDemo.zip有一个完整的工作示例可供下载

【讨论】:

猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-03-27
相关资源
最近更新 更多