Silverlight 银光装订问题

Silverlight 银光装订问题,silverlight,binding,Silverlight,Binding,我有一个堆栈面板,我在绑定中将其datacontext设置为自定义对象“Questions”路径,我在运行时添加框架元素,并将textblock的属性设置为binding(),它将QuestionAnswer显示为object。我想展示问题文本。是因为这个类是抽象的吗? 我有一些继承自QuestionAnswer的类,比如TextBoxQuestionAnswer、CheckboxQuestionAnswer等 当我尝试使用绑定(“TextBoxQuestionAnswer.QuestionTe

我有一个堆栈面板,我在绑定中将其datacontext设置为自定义对象“Questions”路径,我在运行时添加框架元素,并将textblock的属性设置为binding(),它将QuestionAnswer显示为object。我想展示问题文本。是因为这个类是抽象的吗? 我有一些继承自QuestionAnswer的类,比如TextBoxQuestionAnswer、CheckboxQuestionAnswer等

当我尝试使用绑定(“TextBoxQuestionAnswer.QuestionText”)时,屏幕上不会显示任何内容

public class Page
{
        public int PageID { get; set; }
        public ObservableCollection<QuestionAnswer> Questions { get; set; }
}

public abstract class QuestionAnswer
    {
        public int QuestionID { get; set; }
        public string QuestionText { get; set; }
        public QuestionType QuestionType { get; set; }
        public Dictionary<string, string> AnswerOptions { get; set; }
        public string AnswerText { get; set; }
        public AnswerResponse AnswerResponse { get; set; }
    }
公共类页面
{
public int PageID{get;set;}
公共可观察收集问题{get;set;}
}
公共抽象类问答
{
public int QuestionID{get;set;}
公共字符串QuestionText{get;set;}
公共问题类型问题类型{get;set;}
公共字典应答选项{get;set;}
公共字符串应答文本{get;set;}
公共应答应答应答{get;set;}
}

绑定到属性名称,而不是类名,因此
绑定(“TextBoxQuestionAnswer.QuestionText”)
无效

堆栈面板对于绑定到集合没有多大用处。您需要一个具有项模板的容器,以便可以将每个项绑定到集合(列表框、网格等)

我们真的需要看看您的Xaml和绑定代码来澄清这一点