I would like to create datagrid that has nested columns (please look at attached image). Or if possible embed grid into cell. My objects have many different informations, and based on object type I would like to add additional info in my cell (nested Column in the image), that is divided by columns. Is it possible in silverlight ?
Solution:
If it's just displaying values from multiple columns in one column it is best to do this by using a
DataGridTemplateColumn:
<sdk:DataGridTemplateColumn Header="Merged Cols">
<sdk:DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<StackPanel>
<sdk:DataGrid Name="dataGrid2" AutoGenerateColumns="True" HeadersVisibility="None"/>
</StackPanel>
</DataTemplate>
</sdk:DataGridTemplateColumn.CellTemplate>
</sdk:DataGridTemplateColumn>
You could also do this through a converter if you want to use the DataGridTextColumn. As a Silverlight converter only supports one value you'd need to send the entire row.The column definition of the DataGrid would contain<sdk:DataGridTextColumn Binding={Binding Converter={StaticResource MergedCols}} />
You'd need to add the MergedCols converter to your solution and to your resource collection.<UserControl.Resources> <myConverters:MergedColsConverter x:Key="MergedCols" />
No comments:
Post a Comment