Find a control in RowDetailsTemplate
This article demonstrates how to find a control which is placed in the DataTemplate of the RowDetailsTemplate.
Let assume that you have a control (RadComboBox) in the RowDetailsTemplate which you need to set some properties at runtime:
<telerik:RadGridView.RowDetailsTemplate>
<DataTemplate>
<StackPanel>
<telerik:RadComboBox Name="rcbCountries" />
<!-- some other controls here -->
</StackPanel>
</DataTemplate>
</telerik:RadGridView.RowDetailsTemplate>
<telerik:RadGridView Name="gridView"
ItemsSource="{Binding Source={StaticResource itemsList}}"
LoadingRowDetails="gridView_LoadingRowDetails"
RowDetailsVisibilityMode="VisibleWhenSelected">
private void gridView_LoadingRowDetails(object sender, GridViewRowDetailsEventArgs e)
{
RadComboBox countries = e.DetailsElement.FindName("rcbCountries") as RadComboBox;
countries.ItemsSource = GetCountries();
}
Private Sub gridView_LoadingRowDetails(sender As Object, e As GridViewRowDetailsEventArgs)
Dim countries As RadComboBox = TryCast(e.DetailsElement.FindName("rcbCountries"), RadComboBox)
countries.ItemsSource = GetCountries()
End Sub