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

Hierarchial in RadGridView

0 Answers 36 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Hossein
Top achievements
Rank 1
Hossein asked on 14 Sep 2013, 03:08 PM
Dear Sir

I have a table(in SQL), like this: (there are some hierarchical data in this table)

ID    F_ID        Title 
1       0          Hardware
2        1          Laptop
3        2           Sony
4         2          Toshipa
5         2          Asus
6        1            Monitor
7         6            LG
8         6             Samsung

I have used the RadGridview for hierarchical  this data.
The XAML code is:

<telerik:RadGridView Grid.Row="1"  Name="radGridView1"  ShowGroupPanel="False"  AutoGenerateColumns="False"  ItemsSource="{Binding}"  >
            <telerik:RadGridView.ChildTableDefinitions>
                <telerik:GridViewTableDefinition>
                    <telerik:GridViewTableDefinition.Relation>
                        <telerik:TableRelation IsSelfReference="True">
                            <telerik:TableRelation.FieldNames>
                                <telerik:FieldDescriptorNamePair
                            ParentFieldDescriptorName="ID"
                            ChildFieldDescriptorName="F_ID" />
                            </telerik:TableRelation.FieldNames>
                        </telerik:TableRelation>
                    </telerik:GridViewTableDefinition.Relation>
                </telerik:GridViewTableDefinition>
            </telerik:RadGridView.ChildTableDefinitions>
            <telerik:RadGridView.Columns>
                <telerik:GridViewDataColumn DataMemberBinding="{Binding ID}" IsGroupable="False" />
                <telerik:GridViewDataColumn DataMemberBinding="{Binding F_ID}" IsGroupable="False" />
                <telerik:GridViewDataColumn DataMemberBinding="{Binding Title}" IsGroupable="False" />
            </telerik:RadGridView.Columns>
        </telerik:RadGridView>

and the C# code is:

private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            MyLinqObjDataContext db = new MyLinqObjDataContext();
            radGridView1.ItemsSource = db.TBLTests;

        }

and the result of these code is shown in R1.png (attached file).

Now, Could you allow me to know:

1) How I could hide the "Laptop", "Sony", "Toshiba", "Asus" from root of radGridView. Because they are the child of "Hardware", I want to see them ONLY when  the "Hardware" item, is expanded.

2) How I could hide the "+" icon, from beside of "Sony", "Toshiba", "Asus". Because they have not child (not expandable).


I am waiting for your help, PLEASE?
thanks;
 





No answers yet. Maybe you can help?

Tags
GridView
Asked by
Hossein
Top achievements
Rank 1
Share this question
or