This question is locked. New answers and comments are not allowed.
Hi Support
I am trying to accomplish a scenario, where i have 3 levels of radgrids in a custom hierarchy
I want to be able to style the child grids, therefore I have used nested HierarchyChildTemplates inside the master table. Like this:
Notice ive used the pattern as described in the post here.
In the .cs file i have hooked up to the PreviewDataRecordCreate event of the mastergrid:
And in the eventhandler, i fill the tabledefinitions into the child-templates:
The bottom line of this setup is: Only the 1.st level can exand, and the 2.nd level is filled with data, but cannot expand any further (i.e. the 3.rd level is never displayed /filled with data)
Is it not at all possible to use nested Hierarchytemplates?
Regards, Thomas Garp
I am trying to accomplish a scenario, where i have 3 levels of radgrids in a custom hierarchy
I want to be able to style the child grids, therefore I have used nested HierarchyChildTemplates inside the master table. Like this:
| <telerikGridView:RadGridView |
| x:Name="MasterGridView" |
| CanUserInsertRows="False" |
| AutoGenerateColumns="False" |
| CanUserFreezeColumns="False" |
| CanUserReorderColumns="False" |
| Height="600" Width="Auto" Background="#FFC6C6C6" |
| > |
| <telerikGridView:RadGridView.Columns> |
| <telerikGridView:GridViewDataColumn HeaderText="Col1" DataMemberBinding="{Binding Path=CustomerShortDisplayType}" IsFilterable="True" IsGroupable="True" IsSortable="True" Width="55" HeaderCellStyle="{StaticResource GridViewHeaderCellStyle1}" /> |
| <telerikGridView:GridViewDataColumn HeaderText="Col2" DataMemberBinding="{Binding Path=CustomerCurrency}" IsFilterable="True" IsGroupable="True" IsReadOnly="True" Width="55" HeaderCellStyle="{StaticResource GridViewHeaderCellStyle1}" /> |
| </telerikGridView:RadGridView.Columns> |
| <telerikGridView:RadGridView.HierarchyChildTemplate> |
| <DataTemplate > |
| <StackPanel DataContext="{x:Null}"> |
| <telerikGridView:RadGridView |
| x:Name="InnerGridView" |
| CanUserInsertRows="False" |
| AutoGenerateColumns="False" |
| CanUserFreezeColumns="False" |
| CanUserReorderColumns="False" |
| Width="Auto" Background="#FFC6C6C6" |
| ItemsSource="{Binding ChildCustomers}" |
| Loaded="ChildRadGridView_Loaded" |
| ShowColumnHeaders="False" |
| ShowGroupPanel="False" Style="{StaticResource childGridviewStyle}" |
| > |
| <telerikGridView:RadGridView.Columns> |
| <telerikGridView:GridViewDataColumn HeaderText="CustomerName" DataMemberBinding="{Binding Path=CustomerShortDisplayType}" IsFilterable="True" IsGroupable="True" IsSortable="True" Width="55" CellStyle="{StaticResource ChildGridDataCellStyle1}" /> |
| <telerikGridView:GridViewDataColumn HeaderText="Currency" DataMemberBinding="{Binding Path=CustomerCurrency}" IsFilterable="True" IsGroupable="True" IsReadOnly="True" Width="55" CellStyle="{StaticResource ChildGridDataCellStyle1}" /> |
| <telerikGridView:GridViewDataColumn HeaderText="Manager" DataMemberBinding="{Binding Path=Manager}" IsGroupable="True" IsReadOnly="True" Width="55" CellStyle="{StaticResource ChildGridDataCellStyle1}" /> |
| </telerikGridView:RadGridView.Columns> |
| <telerikGridView:RadGridView.HierarchyChildTemplate > |
| <DataTemplate > |
| <StackPanel DataContext="{x:Null}"> |
| <telerikGridView:RadGridView CanUserInsertRows="False" |
| Margin="95,0,0,0" |
| AutoGenerateColumns="False" |
| CanUserFreezeColumns="False" |
| ShowGroupPanel="False" |
| ItemsSource="{Binding CustomerValues}" |
| ShowColumnHeaders="False" |
| Style="{StaticResource childGridviewStyle}" |
| CanUserReorderColumns="False" |
| Loaded="ChildRadGridView_Loaded" |
| > |
| <telerikGridView:RadGridView.Columns> |
| <telerikGridView:GridViewDataColumn HeaderText="Type" DataMemberBinding="{Binding Path=Customer.ShortDisplayCustomerType}" IsSortable="False" IsFilterable="False" IsGroupable="False" IsReadOnly="True" Width="55" CellStyle="{StaticResource ChildGridDataCellStyle}" /> |
| <telerikGridView:GridViewDataColumn HeaderText="Cur." DataMemberBinding="{Binding Path=CurrencyName}" IsSortable="False" IsFilterable="False" IsGroupable="False" IsReadOnly="True" Width="55" CellStyle="{StaticResource ChildGridDataCellStyle}" /> |
| <telerikGridView:GridViewDataColumn HeaderText="Mgr." DataMemberBinding="{Binding Path=Customer.Manager}" IsSortable="False" IsFilterable="False" IsGroupable="False" IsReadOnly="True" Width="55" CellStyle="{StaticResource ChildGridDataCellStyle}"/> |
| </telerikGridView:RadGridView.Columns> |
| </telerikGridView:RadGridView> |
| </StackPanel> |
| </DataTemplate> |
| </telerikGridView:RadGridView.HierarchyChildTemplate> |
| </telerikGridView:RadGridView> |
| </StackPanel> |
| </DataTemplate> |
| </telerikGridView:RadGridView.HierarchyChildTemplate> |
| </telerikGridView:RadGridView> |
Notice ive used the pattern as described in the post here.
In the .cs file i have hooked up to the PreviewDataRecordCreate event of the mastergrid:
| MasterGridView.TableDefinition.PreviewDataRecordCreate += new EventHandler<DataRecordCreateEventArgs>(TableDefinition_PreviewDataRecordCreate); |
And in the eventhandler, i fill the tabledefinitions into the child-templates:
| void TableDefinition_PreviewDataRecordCreate(object sender, DataRecordCreateEventArgs e) |
| { |
| var childCustomerDefinition = new GridViewTableDefinition(); |
| childCustomerDefinition.Relation = new PropertyRelation("ChildCustomers"); |
| childCustomerDefinition.AutoGenerateFieldDescriptors = true; |
| e.IsExpandableRecord = true; |
| var childM2MValues = new GridViewTableDefinition(); |
| childM2MValues.Relation = new PropertyRelation("CustomerValues"); |
| childM2MValues.AutoGenerateFieldDescriptors = false; |
| childCustomerDefinition.ChildTableDefinitions.Add(childM2MValues); |
| e.ChildTableDefinitions.Add(childCustomerDefinition); |
| } |
The bottom line of this setup is: Only the 1.st level can exand, and the 2.nd level is filled with data, but cannot expand any further (i.e. the 3.rd level is never displayed /filled with data)
Is it not at all possible to use nested Hierarchytemplates?
Regards, Thomas Garp