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

How to navigation from an outer Grid to an child Grid

3 Answers 68 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Walter
Top achievements
Rank 1
Walter asked on 04 Oct 2011, 08:34 AM
Hi,

I think it is not a difficult question but I'm searching now since hours and I'm really not able to find the answer.

I've an outer Grid and in the RowDetailsTemplate a RadTabControl and another Grid defined in the TabControl.
OuterGrid -> RowDetailsTemplate -> RadTabControl -> RadTabItem -> InnerGrid
My problem is now, how can I get a reference to the "child" Grid? At the moment can I access the outer grid with "this.outerGridName". The RadTabControl and the inner Grid have both unique names.

My questions are now:
1. How can I get a reference to the inner Grid.
2. Is it possible to navigate from the outer Grid with the RowDetailTemplate to the inner TabControl and Grid? If yes, how?

Thanks in advance
Walter

3 Answers, 1 is accepted

Sort by
0
Ivan Ivanov
Telerik team
answered on 07 Oct 2011, 08:05 AM
Hi Walter,

I have prepared an example project that illustrates such a scenario. It is attached for your reference. Please, inform us whether this solution meets your requirements.

Regards,
Ivan Ivanov
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
0
Walter
Top achievements
Rank 1
answered on 07 Oct 2011, 10:40 AM
Hi Ivan,

The example is quite that what I've atm.
  There is one thing that I want to do and that's not in that example. I have e.g. two RadTabItems and if I Toggle the RowDetails I want to select the second one.

  I've updated the example project with this code but it doesn't work. But the "Players2" Tab is not selected when the RowDetails are toggled. I've already tried in a few ways to do this but nothing works. Can You say how to do this please?
   
The xaml is now (in italic are the changes):
<Window x:Class="RadGridView_WPF_AR_112.MainWindow"
        xmlns:my="clr-namespace:RadGridView_WPF_AR_112"
        Title="MainWindow" Height="700" Width="700">
    <Window.Resources>
        <my:MyViewModel x:Key="MyViewModel"/>
    </Window.Resources>
    <Grid DataContext="{StaticResource MyViewModel}">   
        <Grid.Resources>
            <DataTemplate x:Key="RowDetailsTemplate">
                <telerik:RadTabControl>
                    <telerik:RadTabControl.Items>
                        <telerik:RadTabItem Header="Players">
                            <telerik:RadGridView Name="playersGrid"
                                                 Loaded="playersGrid_Loaded"
                                     ItemsSource="{Binding Players}" 
                                     AutoGenerateColumns="False">
                                <telerik:RadGridView.Columns>
                                    <telerik:GridViewDataColumn DataMemberBinding="{Binding Name}"/>
                                    <telerik:GridViewDataColumn DataMemberBinding="{Binding Number}"/>
                                    <telerik:GridViewDataColumn DataMemberBinding="{Binding Position}"/>
                                    <telerik:GridViewDataColumn DataMemberBinding="{Binding Country}"/>
                                </telerik:RadGridView.Columns>
                            </telerik:RadGridView>
                        </telerik:RadTabItem>
                        <telerik:RadTabItem Header="Players2">
                       </telerik:RadTabItem>
                    </telerik:RadTabControl.Items>
                </telerik:RadTabControl>                
            </DataTemplate>
        </Grid.Resources>
        <telerik:RadGridView Grid.Row="0" 
                             Name="clubsGrid" 
                             ItemsSource="{Binding Clubs}"
                             AutoGenerateColumns="False"
                             RowDetailsTemplate="{StaticResource RowDetailsTemplate}"
                             RowDetailsVisibilityChanged="gridView_RowDetailsVisibilityChanged" 
                             Margin="5">
            <telerik:RadGridView.Columns>
                <telerik:GridViewToggleRowDetailsColumn/>
                <telerik:GridViewDataColumn DataMemberBinding="{Binding Name}"/>
                <telerik:GridViewDataColumn DataMemberBinding="{Binding Established}"
                                            Header="Est." 
                                            DataFormatString="{}{0:yyyy}"/>
                <telerik:GridViewDataColumn DataMemberBinding="{Binding StadiumCapacity}" 
                                            Header="Stadium" 
                                            DataFormatString="{}{0:N0}"/>
            </telerik:RadGridView.Columns>
        </telerik:RadGridView>      
    </Grid>
</Window>

and the Code behind:
private void gridView_RowDetailsVisibilityChanged(object sender, GridViewRowDetailsEventArgs e)
{
 var content = clubsGrid.RowDetailsTemplate.LoadContent();
 ((RadTabControl)content).SelectedIndex = 1;
}

Thanks in advance
0
Ivan Ivanov
Telerik team
answered on 12 Oct 2011, 09:11 AM
Hello Walter,

I have noticed that a colleague of mine has posted an answer to this inquiry in the other support thread you have opened. In order to achieve a fruitful and consistent dialogue, I would ask you to carry out any further communication there. Thank you.

All the best,
Ivan Ivanov
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
Tags
GridView
Asked by
Walter
Top achievements
Rank 1
Answers by
Ivan Ivanov
Telerik team
Walter
Top achievements
Rank 1
Share this question
or