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

controls inside TileView

2 Answers 80 Views
TileView
This is a migrated thread and some comments may be shown as answers.
kannan
Top achievements
Rank 1
kannan asked on 23 Nov 2010, 05:01 AM
Hi,
 I have some controls inside Tileview.like RadChart present inside TileView , and checkbox present inside RadChart. so i want to get the name of checkbox in TileView_TileStateChanged event..
TileView
       |_RadChart
                |_CheckBox

Thanks In Advance,
kannan.s

 

2 Answers, 1 is accepted

Sort by
0
Kiril Stanoev
Telerik team
answered on 23 Nov 2010, 09:55 AM
Hi kannan,

You can use the VisualTreeHelper class or our extension method ChildrenOfType.

<telerik:RadTileView TileStateChanged="RadTileView_TileStateChanged">
    <telerik:RadTileViewItem Header="Item 0">
        <CheckBox x:Name="targetCheckBox" Content="Target" HorizontalAlignment="Center"
                VerticalAlignment="Center" />
    </telerik:RadTileViewItem>
    <telerik:RadTileViewItem Header="Item 1"></telerik:RadTileViewItem>
    <telerik:RadTileViewItem Header="Item 2"></telerik:RadTileViewItem>
</telerik:RadTileView>

private void RadTileView_TileStateChanged(object sender, Telerik.Windows.RadRoutedEventArgs e)
{
    RadTileViewItem item = e.OriginalSource as RadTileViewItem;
    CheckBox targetCheckBox = item.ChildrenOfType<CheckBox>().Where(checkbox => checkbox.Name == "targetCheckBox").FirstOrDefault();
    if (targetCheckBox != null)
    {
        MessageBox.Show("Target found");
    }
}

Please bear in mind that traversing the visual tree up and down will have a performance impact on your application, so choose wisely.

Greetings,
Kiril Stanoev
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
0
kannan
Top achievements
Rank 1
answered on 23 Nov 2010, 12:54 PM
Hi Kiril Stanoev,

     Thanks for your reply. it is working fine..
Tags
TileView
Asked by
kannan
Top achievements
Rank 1
Answers by
Kiril Stanoev
Telerik team
kannan
Top achievements
Rank 1
Share this question
or