Hi,
I'm currently trying to display two datatypes in a single RadTreeListView. The first datatype, 'Desk', have only two properties: 'Name', and a property 'Books' containing the second datatype: 'Book'.
I want to display a column 'Name' populated by both types, and a few other columns (in this example : 'Location') populated only for the child elements (Book).
Even though I wasn't able to create different templates for each types, the data could be binded since the property names are matching, and I can edit the Desk's properties. But the grid throws a 'Object does not match target type' exception when I try to edit a Book's properties.
Am I doing something wrong? Is there a workaround for this problem?
(enclosed screenshot)
I'm currently trying to display two datatypes in a single RadTreeListView. The first datatype, 'Desk', have only two properties: 'Name', and a property 'Books' containing the second datatype: 'Book'.
public
class
Desk
{
public
string
Name {
get
;
set
; }
public
List<Book> Books {
get
;
set
; }
}
public
class
Book
{
public
string
Name {
get
;
set
; }
public
string
Location {
get
;
set
; }
// Other stuff
}
I want to display a column 'Name' populated by both types, and a few other columns (in this example : 'Location') populated only for the child elements (Book).
Even though I wasn't able to create different templates for each types, the data could be binded since the property names are matching, and I can edit the Desk's properties. But the grid throws a 'Object does not match target type' exception when I try to edit a Book's properties.
<
telerikGridView:RadTreeListView
x:Name
=
"RadTreeListView1"
AutoGenerateColumns
=
"False"
IsReadOnly
=
"False"
RowIndicatorVisibility
=
"Collapsed"
ItemsSource
=
"{Binding Path=Desks}"
>
<
telerikGridView:RadTreeListView.ChildTableDefinitions
>
<
telerikGridView:TreeListViewTableDefinition
ItemsSource
=
"{Binding Path=Books}"
/>
</
telerikGridView:RadTreeListView.ChildTableDefinitions
>
<
telerikGridView:RadTreeListView.Columns
>
<
telerikGridView:GridViewDataColumn
DataMemberBinding
=
"{Binding Path=Name}"
Header
=
"Name"
Width
=
"150"
/>
<
telerikGridView:GridViewDataColumn
DataMemberBinding
=
"{Binding Path=Description}"
Header
=
"Description"
Width
=
"*"
/>
<
telerikGridView:GridViewDataColumn
DataMemberBinding
=
"{Binding Path=Location.Name}"
Header
=
"Location"
Width
=
"100"
/>
<
telerikGridView:GridViewDataColumn
DataMemberBinding
=
"{Binding Path=Intention}"
Header
=
"Intention"
Width
=
"100"
/>
<
telerikGridView:GridViewDataColumn
DataMemberBinding
=
"{Binding Path=TreatmentType}"
Header
=
"Treatment Type"
Width
=
"100"
/>
<
telerikGridView:GridViewDataColumn
DataMemberBinding
=
"{Binding Path=AccountingTreatment}"
Header
=
"Accounting Treatment"
Width
=
"100"
/>
<
telerikGridView:GridViewDataColumn
DataMemberBinding
=
"{Binding Path=IfrsType}"
Header
=
"Ifrs Type"
Width
=
"100"
/>
</
telerikGridView:RadTreeListView.Columns
>
</
telerikGridView:RadTreeListView
>
Am I doing something wrong? Is there a workaround for this problem?
(enclosed screenshot)