This is a migrated thread and some comments may be shown as answers.

ChildTableDefinitions/PropertyRelation

6 Answers 556 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Martin
Top achievements
Rank 2
Martin asked on 01 Feb 2010, 01:07 PM

 

 

Hi,
I am using the PropertyRelation on the RadgridView like so:

<
Telerik:RadGridView.ChildTableDefinitions

 

    <Telerik:GridViewTableDefinition x:Name="gvtd"> 

 

        <Telerik:GridViewTableDefinition.Relation

 

            <telerikData:PropertyRelation ParentPropertyName="MyProperty"/> 

 

        </Telerik:GridViewTableDefinition.Relation
    </Telerik:GridViewTableDefinition>
</Telerik:RadGridView.ChildTableDefinitions>

Which works fine when it autogenerates the columns.. is there an example on how to user define the columns?


My futile tries involve:
AutoGenerateColoumns="False"
or   

AutoGenerateFieldDescriptors

 

="False"

I have tried setting the FieldDescriptors manually.

Tried to use HierarchyChildTemplate like so:

 

 

 

<Telerik:RadGridView.HierarchyChildTemplate

 

    <DataTemplate>

        <Telerik:RadGridView

 

            <Telerik:RadGridView.Columns
                <Telerik:GridViewDataColumn Header="ID" UniqueName="id"/>

                <Telerik:GridViewDataColumn Header="FirstName" DataMemberBinding="{Binding Name}"/>

            </Telerik:RadGridView.Columns>

        </Telerik:RadGridView>

    </DataTemplate>

</Telerik:RadGridView.HierarchyChildTemplate>


With the result of it loosing its binding and going back to the usercontrols dataContext.

- Martin

 

 

 

 

 

 

 

 

 

 

6 Answers, 1 is accepted

Sort by
0
Accepted
Vlad
Telerik team
answered on 01 Feb 2010, 01:19 PM
Hi Martin,

You can successfully replace  GridViewTableDefinition with PropertyRelation with following HierarchyChildTemplate declaration:
...
<Telerik:RadGridView.ChildTableDefinitions>
    <Telerik:GridViewTableDefinition />
</Telerik:RadGridView.ChildTableDefinitions>
<Telerik:RadGridView.HierarchyChildTemplate>
     <DataTemplate>
        <Telerik:RadGridView ItemSource="{Binding MyProperty}" AutoGenerateColumns="False"
            <Telerik:RadGridView.Columns>
                <Telerik:GridViewDataColumn Header="ID" UniqueName="id"/>
                <Telerik:GridViewDataColumn Header="FirstName" DataMemberBinding="{Binding Name}"/>
            </Telerik:RadGridView.Columns>
        </Telerik:RadGridView>
    </DataTemplate>
</Telerik:RadGridView.HierarchyChildTemplate>
...
Best wishes,
Vlad
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Martin
Top achievements
Rank 2
answered on 01 Feb 2010, 01:28 PM
Hi Vlad
Worked like a charm... saved my day :) 

Thank you!
0
Toby Riley
Top achievements
Rank 1
answered on 13 Jun 2010, 09:01 PM
Hi Vlad,

What if you still want to enforce the PropertyRelation between the Parent and the Child Items. You example chooses the correct child columns by the relation is lost.

How do you maintain the related master detail relationship.

Thanks

Toby.
0
Vlad
Telerik team
answered on 14 Jun 2010, 07:00 AM
Hello,

 Can you post more info about your scenario? How the grid is declared and bound in your case?

Best wishes,
Vlad
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
james
Top achievements
Rank 1
answered on 06 Jun 2012, 05:37 AM
Hi Support,

Is it possible to "inherit" the column definition from the parent table?

I have implemented a column picker so the user can pick what columns are visible, i want this to affect the child tables.

Regards,
James
0
Vlad
Telerik team
answered on 07 Jun 2012, 05:37 AM
Hi,

 Maybe you should bind columns visibility to all grid definitions if you want your setting to affect all grids including child grids in hierarchy. You can declare your child grids using HierarchyChildTemplate. 

Kind regards,
Vlad
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
GridView
Asked by
Martin
Top achievements
Rank 2
Answers by
Vlad
Telerik team
Martin
Top achievements
Rank 2
Toby Riley
Top achievements
Rank 1
james
Top achievements
Rank 1
Share this question
or