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

[Solved] Master detail with RIA

3 Answers 149 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Edo Cof
Top achievements
Rank 1
Edo Cof asked on 01 Mar 2010, 12:30 PM
I have 2 table in relation one to many. So i want to achieve something like that. Some master detail (i think)

I also found and read this great post, but i am confused. In this example, the author used 2 RadGridView, but in first link ChildTableDefinitions is used.

My questions is which one to used. I would rather see + (used in first example to open details) that -> (used in secod example to open details).
I also don't understand when exactly used ChildTableDefinitions and why it isn't used in secodn post.

Thanks


3 Answers, 1 is accepted

Sort by
0
Accepted
Vlad
Telerik team
answered on 02 Mar 2010, 07:44 AM
Hi,

These are just different techniques to achieve similar result - you can use both the grid hierarchy or row details to create master/detail. With hierarchy by default you will get "+" in front of every row and if you want the same with row details you should use GridViewToggleRowDetailsColumn.

Greetings,
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
Edo Cof
Top achievements
Rank 1
answered on 02 Mar 2010, 06:43 PM
Well, i have another questions.
Lets say, that i don't want to use IValueConverter and that i want to set ItemsSource in code, when + is clicked.
My template would be:
<DataTemplate x:Key="AlbumsTemplate"> 
    <Grid Width="500" HorizontalAlignment="Left" Margin="24,2,2,2"> 
             <telerik:RadGridView 
                        Name="albumsGrid" 
                        Margin="2"> 
             </telerik:RadGridView> 
    </Grid> 
</DataTemplate> 
 
Now, how can i set to this grid instance (that has created for row details) ItemsSource.

I would guess, that i need some event when + is clicked, and that this event has which FrameworkElement is set in Template (in my case Grid width="500"...) and row details. I need some data from fields (gridMainGrid.Row[+ ic clicked].Column["id"]... or something like that).

Just trying to tell what i need to do:
The problem is, that i don't now how template would look (because the idea is to set it in code ((DataTemplate) XamlReader.Load("<DataTemplate>...</DataTemplate>");
)) and it could be every time different.
In one case i would like to see albumsGrid, in another case concertsGrid. Maybe bothly. So i create some method to add as many DetailsGrid as you want. And because of that i can not set template in xaml, because i don't know how many RadGridView i want. It depends on the instance (UserControl).
0
Accepted
Vlad
Telerik team
answered on 04 Mar 2010, 07:08 AM
Hi,

Still the best approach will be MVVM (ItemsSource goes in your dynamic XAML) however if you really do not want this you can use IsExpandedChanged event of GridViewRow in case of hierarchy or RowDetailsVisibilityChanged event of GridViewDataControl in case of row details.

Greetings,
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.
Tags
GridView
Asked by
Edo Cof
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Edo Cof
Top achievements
Rank 1
Share this question
or