<
telerik:RadGridView
x:Name
=
"RadGridView1"
ItemsSource
=
"{Binding}"
Grid.Row
=
"1"
GroupPanelForeground
=
"Red"
>
<
telerik:RadGridView.ChildTableDefinitions
>
<
telerik:GridViewTableDefinition
>
<
telerik:GridViewTableDefinition.Relation
>
<
telerik:PropertyRelation
ParentPropertyName
=
"Students"
/>
</
telerik:GridViewTableDefinition.Relation
>
</
telerik:GridViewTableDefinition
>
</
telerik:RadGridView.ChildTableDefinitions
>
</
telerik:RadGridView
>
In my Linq to SQL Class I have Students Table and Subjects.
Students field has Student ID, StudentFN, StudentLN while Subjects has SubjectID, Subject, Professor, StudentID.
I have associated the two student id.
My .xaml.cs is
public
partial
class
MainWindow : Window
{
ObservableCollection<MyObject> _MyObject =
new
ObservableCollection<MyObject>();
DataContextDataContext context1 =
new
DataContextDataContext();
public
MainWindow()
{
InitializeComponent();
DataContext =
new
ObservableCollection<MyObject>();
RadGridView1.Filtered+=
new
EventHandler<GridViewFilteredEventArgs>(RadGridView1_Filtered);
foreach
(var p
in
context1.Students)
{
_MyObject.Add(
new
MyObject { ID = p.StudentID, Name = p.StudentFN });
}
}
void
RadGridView1_Filtered(
object
sender, GridViewFilteredEventArgs e)
{
RadGridView1.ItemsSource = _MyObject;
}
private
void
Button_Click(
object
sender, RoutedEventArgs e)
{
}
}
public
class
MyObject
{
public
int
ID {
get
;
set
; }
public
string
Name {
get
;
set
; }
}
I tried running the gridview but it doesn't show the level 2 data grid for the each record nor the column headers of the subject table.