This question is locked. New answers and comments are not allowed.
Constructor
public CountryView()
{
InitializeComponent();
GridViewTableDefinition detailDefinition = new GridViewTableDefinition();
detailDefinition.Relation = new PropertyRelation("ID");
countryRadGridView.TableDefinition.ChildTableDefinitions.Add(detailDefinition);
}
.xaml
<telerikGridView:RadGridView Grid.Row="1" Margin="8,8,8,8"
x:Name="countryRadGridView"
UseAlternateRowStyle="True"
UseLayoutRounding="True"
ColumnsWidthMode="Fill"
AutoGenerateColumns="False"
ItemsSource="{Binding CountryList, Mode=TwoWay }">
<telerikGridView:RadGridView.Columns>
<telerikGridView:GridViewDataColumn HeaderText="ID" IsReadOnly="True" DataMemberBinding="{Binding ID, Mode=TwoWay}" />
<telerikGridView:GridViewDataColumn HeaderText="Country Name" IsReadOnly="True" DataMemberBinding="{Binding Name, Mode=TwoWay}" />
</telerikGridView:RadGridView.Columns>
<telerikGridView:RadGridView.HierarchyChildTemplate>
<DataTemplate>
<telerikGridView:RadGridView Margin="45,8,30,8" UseAlternateRowStyle="True" x:Name="stateRadGridView" ItemsSource="{Binding StateList, Mode=TwoWay}" ColumnsWidthMode="Fill"
AutoGenerateColumns="False">
<telerikGridView:RadGridView.Columns>
<telerikGridView:GridViewDataColumn HeaderText="State ID" IsReadOnly="True" DataMemberBinding="{Binding ID, Mode=TwoWay}" Width="100" />
<telerikGridView:GridViewDataColumn HeaderText="State Name" IsReadOnly="True" DataMemberBinding="{Binding Name, Mode=TwoWay}" Width="130" />
</telerikGridView:RadGridView.Columns>
</telerikGridView:RadGridView>
</DataTemplate>
</telerikGridView:RadGridView.HierarchyChildTemplate>
</telerikGridView:RadGridView>
I have binded the CountryList to ItemsSource of countryRadGridView through ViewModel which work fine and only the country list get binded StateList doesnot get Binded on clicking the + . StateList contains data for sure.
CountryList is a list class of country
public class County
{
public int ID {get;set;}
public string Name {get;set;}
public List<State> StateList {get;set;}
}
public class State
{
public int ID {get;set;}
public string Name {get;set;}
}
Issue
StateList doesnot get Binded on clicking the +
Note:
I could not set ChildTableDefinitions in xaml Instead I have done it xaml.cs
when I tried this in xaml it did not support
<telerik:RadGridView.ChildTableDefinitions>
<telerik:GridViewTableDefinition />
</telerik:RadGridView.ChildTableDefinitions>
