如何在Silverlight 3 datagrid中动态插入具有不同标题/列布局的行?
假设我有来自Silverlight 3的DataGrid控件,我想在两行之间动态创建一些空闲空间来显示更多细节。我该怎么做如何在Silverlight 3 datagrid中动态插入具有不同标题/列布局的行?,silverlight,Silverlight,假设我有来自Silverlight 3的DataGrid控件,我想在两行之间动态创建一些空闲空间来显示更多细节。我该怎么做 Header1 | Header2 | Header3 | Header4 ------------------------------------- Cell1 Cell2 Cell3 Cell4 Cell5 Cell6 Cell7 Cell8 Cell9 Cell10 Cell11 Cell12 例如
Header1 | Header2 | Header3 | Header4
-------------------------------------
Cell1 Cell2 Cell3 Cell4
Cell5 Cell6 Cell7 Cell8
Cell9 Cell10 Cell11 Cell12
例如,应成为:
Header1 | Header2 | Header3 | Header4
-------------------------------------
Cell1 Cell2 Cell3 Cell4
Cell5 Cell6 Cell7 Cell8
Foo1 Foo2
Foo3 Foo4
Cell9 Cell10 Cell11 Cell12
请注意,新插入的两个“行”可能具有不同的列计数,并且可能是不同类型的控件。换句话说,插入的项可能是另一个单独的控件
使用DataGrid控件是否可以实现这一点?也许有人有一些聪明的想法。
非常感谢 您将需要一个类型类(即Cell)的集合,该集合在单元格上显示property.Foos集合。(简写为示例属性)
Class Foo
Property FooName as String
End Class
Class Cell
Property CellName as String
ReadOnly Property Foos as Generic.List(of Foo)
End Class
<DataTemplate x:Key="MyTemplate">
<TextBlock Text={Binding CellName}" />
<StackPanel ItemSource="{Binding Foos}">
<StackPanel.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding FooName}" />
<DataTemplate>
<StackPanel.ItemTemplate>
</StackPanel>
</DataTemplate>