1

When you create a RowDetailsTemplate in a Silverlight grid you can specify a template for row details that is shown directly below the row when it is selected.

The details I have for one of my datagrids would look a lot better immediately before each individual row, rather than after it.

I've tried modifying the template in Blend, but end up getting stuck when I get to this part of the template:

<sdk:DataGridRowsPresenter x:Name="RowsPresenter" 
 Grid.ColumnSpan="2" Grid.Row="1"/>

There does not seem to be an associated template for DataGridRowsPresenter so I cannot seem to find how I might be able to move the details above the row.

Is this possible?

Simon_Weaver
  • 140,023
  • 84
  • 646
  • 689

1 Answers1

1

My work associate found this solution. It works in Expression Blend 4 using .NET 4

Create a project containing the datagrid. This works in Silverlight as well as WPF. On the datagrid, use "Edit Additional Templates" and create a copy of the RowStyle. Edit the RowStyle, and you'll see where the following lines are:

<sdk:DataGridRowHeader x:Name="RowHeader"
 sdk:DataGridFrozenGrid.IsFrozen="True" Grid.RowSpan="3"/>

 sdk:DataGridCellsPresenter x:Name="CellsPresenter" Grid.Column="1"
 sdk:DataGridFrozenGrid.IsFrozen="True"

 sdk:DataGridDetailsPresenter x:Name="DetailsPresenter" Grid.Column="1" Grid.Row="1"

The DataGridCellsPresenter and the DataGridDetailsPresenter are classes in the System.Windows.Controls.Primitive namespace.

What you do is interchange the Cells Presenter and the Details Presenter, save the style, and assign the style to the DataGrid RowStyle property. Your details will then appear above the row cell elements.

I don't know of a way besides Blend to get the entire Row Style.

Stewbob
  • 16,759
  • 9
  • 63
  • 107
Ronald Fox
  • 11
  • 1