2
在Silverlight中,我試圖構建報表列表框,並試圖在外部報表列表框的數據模板的列表框中顯示報表參數。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>
爲報告工作的標題綁定,但其內每個報告的列表框都是空的。
填充參數列表。
我在做什麼錯?
謝謝!
謝謝Viggity!像魅力一樣工作! – 2011-05-25 17:01:52
高興地幫助:) – viggity 2011-05-27 13:11:14
感謝x1000!只有我和谷歌4小時才能找到... – Matt 2014-01-15 19:59:57