To acess controls on click of Hyperlinkbutton in RadPanelBar for Silverlight

2 posts, 0 answers
  1. Sukhminder
    Sukhminder avatar
    2 posts
    Member since:
    Jul 2011

    Posted 20 Jul 2011 Link to this post


    I am using the following code to bind the data to the RadPanelBar for Silverlight, It works fine.
    I have a HyperLinkButton in my PanelBar. my question, On the click of a hyperlinkbutton, how can I access the other two controls i.e. textBlocks (CategoryTitle and Score) of the same row?

            <DataTemplate x:Key="PanelBarItemTemplate">
                <Grid x:Name="grdCategory" ShowGridLines="True">
                        <RowDefinition Height="30"></RowDefinition>
                        <ColumnDefinition Width="60*"></ColumnDefinition>
                        <ColumnDefinition Width="40*"></ColumnDefinition>
                    <Grid x:Name="grdSubCategory" Grid.Column="0" Style="{StaticResource CategoryLeftStyle}" >
                            <RowDefinition Height="20"></RowDefinition>
                            <ColumnDefinition Width="50*"></ColumnDefinition>
                            <ColumnDefinition Width="25*"></ColumnDefinition>
                            <ColumnDefinition Width="25*"></ColumnDefinition>
                        <TextBlock Text="{Binding CategoryTitle}" Grid.Row="0" Grid.Column="0"/>
                        <HyperlinkButton Grid.Row="0" Grid.Column="1" Style="{StaticResource DetailLinkStyle}" Content="Details" Click="Home_Click"></HyperlinkButton>
                        <TextBlock Text="{Binding Score}" Grid.Row="0" Grid.Column="2"/>
                    <TextBlock Text="92%" Grid.Column="1" Grid.Row="0" Grid.RowSpan="2" FontSize="32" FontWeight="Bold"/>

            <telerik:HierarchicalDataTemplate x:Key="PanelBarHeaderTemplate"
                                      ItemsSource="{Binding SubReports}"
                                      ItemTemplate="{StaticResource PanelBarItemTemplate}">
                <TextBlock Text="{Binding CategoryTitle}" />

    <telerik:RadPanelBar x:Name="radPanelBar"
                                         ItemTemplate="{StaticResource PanelBarHeaderTemplate}"
                                         IsSingleExpandPath="False" ItemClick="radPanelBar_ItemClick">
  2. Petar Mladenov
    Petar Mladenov avatar
    2986 posts

    Posted 25 Jul 2011 Link to this post

    Hello Sukhminder,

     You can use the telerik`s extension methods ParentOfType<> and ChildrenOfType<> like so:

    using Telerik.Windows.Controls;
    private void HyperlinkButton_Click(object sender, RoutedEventArgs e)
               Grid parentGrid = (sender as HyperlinkButton).ParentOfType<Grid>();
               if (parentGrid != null)
                   TextBlock t = parentGrid.ChildrenOfType<TextBlock>()[0];
                   if (t != null)

    Kind regards,
    Petar Mladenov
    the Telerik team

    Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

Back to Top