【发布时间】:2011-09-01 19:16:20
【问题描述】:
在 silverlight 中,我正在尝试构建报告列表框,并尝试在外部报告列表框的数据模板内的列表框中显示报告的参数。
以下是数据类:
public class Report
{
public string Title { get; set; }
public string Description { get; set; }
public List<ReportParameter> Parameters = new List<ReportParameter>();
}
public class ReportParameter
{
public string Name { get; set; }
public string ParameterType { get; set; }
public bool Required { get; set; }
}
这是我尝试使用的 XAML:
<ListBox x:Name="lstReports">
<ListBox.ItemTemplate>
<DataTemplate>
<Border>
<StackPanel>
<TextBlock Text="{Binding Title}"/>
<ListBox ItemsSource="{Binding Parameters}" Height="60" Width="60">
<ListBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Name}"/>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</StackPanel>
</Border>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
报表标题的绑定有效,但每个报表的内部列表框都是空的。
参数列表已填充。
我做错了什么?
谢谢!
【问题讨论】:
标签: silverlight xaml binding listbox