Here is XML code:
<telerik:RadTreeListView x:Name="myDataGrid" RowActivated="myDataGrid_RowActivated"
AutoGenerateColumns="False" IsReadOnly="True"
CanUserFreezeColumns="False" Height="600" AutoLoadHierarchy="False" RowIndicatorVisibility="Collapsed">
<telerik:RadTreeListView.ChildTableDefinitions>
<telerik:TreeListViewTableDefinition ItemsSource="{Binding FormItems}" />
</telerik:RadTreeListView.ChildTableDefinitions>
<telerik:RadTreeListView.Columns>
<telerik:GridViewDataColumn TextAlignment="Left" DataMemberBinding="{Binding ReportName}" Header="Report Name" Width="140"/>
<telerik:GridViewDataColumn DataMemberBinding="{Binding ReportNumber}" Header="Report Number" Width="140"/>
<telerik:GridViewDataColumn DataMemberBinding="{Binding Status}" Header="Status" Width="140"/>
<telerik:GridViewDataColumn DataMemberBinding="{Binding Date_Created}" Header="Date Created" Width="140"/>
<telerik:GridViewDataColumn DataMemberBinding="{Binding UserID}" Header="User Name" Width="140"/>
<!--<telerik:GridViewDataColumn Header="Reserve" Width="140"/>-->
</telerik:RadTreeListView.Columns>
</telerik:RadTreeListView >
In ViewModel:
private ObservableCollection<FormItem> _formitems;
public ObservableCollection<FormItem> FormItems
{
get { return _formitems; }
set
{
_formitems = value;
RaisePropertyChanged("FormItems");
}
}
Here is FormItem Class code:
public class FormItem
{
public FormItem(Report _formitem)
{
this.ReportName =_formitem.ReportName ;
this.ReportNumber = _formitem.ReportNumber;
this.Status = _formitem.Status;
this.Date_Created = _formitem.Date_Created;
this.UserID = _formitem.UserID;
this.ID = _formitem.ID;
this.Items = new ObservableCollection<FormItem>();
}
public ObservableCollection<FormItem> Items
{
get;
set;
}
public String ReportName
{
get;
set;
}
public String ID
{
get;
set;
}
public String ReportNumber
{
get;
set;
}
public int Status
{
get;
set;
}
public DateTime Date_Created
{
get;
set;
}
public string UserID
{
get;
set;
}
}
<telerik:RadTreeListView x:Name="myDataGrid" RowActivated="myDataGrid_RowActivated"
AutoGenerateColumns="False" IsReadOnly="True"
CanUserFreezeColumns="False" Height="600" AutoLoadHierarchy="False" RowIndicatorVisibility="Collapsed">
<telerik:RadTreeListView.ChildTableDefinitions>
<telerik:TreeListViewTableDefinition ItemsSource="{Binding FormItems}" />
</telerik:RadTreeListView.ChildTableDefinitions>
<telerik:RadTreeListView.Columns>
<telerik:GridViewDataColumn TextAlignment="Left" DataMemberBinding="{Binding ReportName}" Header="Report Name" Width="140"/>
<telerik:GridViewDataColumn DataMemberBinding="{Binding ReportNumber}" Header="Report Number" Width="140"/>
<telerik:GridViewDataColumn DataMemberBinding="{Binding Status}" Header="Status" Width="140"/>
<telerik:GridViewDataColumn DataMemberBinding="{Binding Date_Created}" Header="Date Created" Width="140"/>
<telerik:GridViewDataColumn DataMemberBinding="{Binding UserID}" Header="User Name" Width="140"/>
<!--<telerik:GridViewDataColumn Header="Reserve" Width="140"/>-->
</telerik:RadTreeListView.Columns>
</telerik:RadTreeListView >
In ViewModel:
private ObservableCollection<FormItem> _formitems;
public ObservableCollection<FormItem> FormItems
{
get { return _formitems; }
set
{
_formitems = value;
RaisePropertyChanged("FormItems");
}
}
Here is FormItem Class code:
public class FormItem
{
public FormItem(Report _formitem)
{
this.ReportName =_formitem.ReportName ;
this.ReportNumber = _formitem.ReportNumber;
this.Status = _formitem.Status;
this.Date_Created = _formitem.Date_Created;
this.UserID = _formitem.UserID;
this.ID = _formitem.ID;
this.Items = new ObservableCollection<FormItem>();
}
public ObservableCollection<FormItem> Items
{
get;
set;
}
public String ReportName
{
get;
set;
}
public String ID
{
get;
set;
}
public String ReportNumber
{
get;
set;
}
public int Status
{
get;
set;
}
public DateTime Date_Created
{
get;
set;
}
public string UserID
{
get;
set;
}
}