Hi Telerik,
I have a gridview that has the look, columns setup, context menu and more , all setup the way I want. What I need is to view child items in a child gridview where the columns, context menu, functionality etc, are the same like the parent grid. My object model (shortened for this example) is as follows.
I would also like to add other controls to the details view in the future. I have read other posts and have tried using a <dataTemplate> with another gridview but could not get the relation property to populate the child gridview. Not to mention I have to manage 2 gridviews instead of one. What's the best way to approach this?
I also noticed that when there are no children objects, the parent row still has a "+" sign which then opens up the child grid with no items in it. Is there a way to turn this off?
Thanks!
public class Person |
{ |
string name; |
datetime dob; |
char gender; |
List<Person> children; |
} |
<telerikGridView:RadGridView> |
<telerikGridView:RadGridView.ChildTableDefinitions> |
<telerikGridView:GridViewTableDefinition> |
<telerikGridView:GridViewTableDefinition.Relation> |
<telerikData:PropertyRelation ParentPropertyName="children" /> |
</telerikGridView:GridViewTableDefinition.Relation> |
</telerikGridView:GridViewTableDefinition> |
</telerikGridView:RadGridView.ChildTableDefinitions> |
<telerikGridView:RadGridView.Columns> |
<telerikGridView:GridViewSelectColumn/> |
<telerikGridView:GridViewDataColumn DataMemberBinding="{Binding name}" Header="Name" /> |
<telerikGridView:GridViewDataColumn DataMemberBinding="{Binding dob}" Header="dob" /> |
<telerikGridView:GridViewDataColumn DataMemberBinding="{Binding gender}" Header="Gender" /> |
</telerikGridView:RadGridView.Columns> |
<telerikNavigation:RadContextMenu.ContextMenu> |
<telerikNavigation:RadContextMenu x:Name="contextMenuGrid" Opened="contextMenuGrid_Opened"> |
<telerikNavigation:RadContextMenu.Items> |
<telerikNavigation:RadMenuItem Header="Delete" Click="Delete_Click"/> |
</telerikNavigation:RadContextMenu.Items> |
</telerikNavigation:RadContextMenu> |
</telerikNavigation:RadContextMenu.ContextMenu> |
</telerikGridView:RadGridView> |