I'm using a RadTreeListView to display the following data (this is a mockup of the real business model):
Directory AAA
|__ SourceFile 001
|__ Function 001
|__ Function 002
|__ SourceFile 002
|__ Function 001
|__ Function 002
Directory BBB
|__ Directory BBB.1
|__ SourceFile 001
|__ Function 001
|__ SourceFile 002
|__ Function 001
|__ Function 002
Model for these and the xaml are using are below:
So my issue is that if I leave the binding for Functions in the XAML I get what you can see in pic 1 (issue.jpg) the third level directory entries are not expandable; if I remove that binding then I get the hierarchy working, of course up until the source file level (no_functions_binding.jpg).
Any idea what could be going on?
Thanks,
Jose
Directory AAA
|__ SourceFile 001
|__ Function 001
|__ Function 002
|__ SourceFile 002
|__ Function 001
|__ Function 002
Directory BBB
|__ Directory BBB.1
|__ SourceFile 001
|__ Function 001
|__ SourceFile 002
|__ Function 001
|__ Function 002
Model for these and the xaml are using are below:
// 1) Classes that define each of the levels (NodeItem being the base class)
public
class
NodeItem
{
public
string
Name {
get
;
set
; }
public
string
Path {
get
;
set
; }
}
public
class
SourceDirectoryItem : NodeItem
{
public
SourceDirectoryItem()
{
this
.Children =
new
ObservableCollection<NodeItem>();
}
public
ObservableCollection<NodeItem> Children {
get
;
set
; }
}
public
class
SourceFileItem : NodeItem
{
public
SourceFileItem()
{
this
.Functions =
new
ObservableCollection<NodeItem>();
}
public
ObservableCollection<NodeItem> Functions {
get
;
set
; }
}
public
class
FunctionItem : NodeItem
{
}
// 2) XAML
<telerik:RadTreeListView
AutoGenerateColumns=
"False"
ItemsSource=
"{Binding Nodes}"
>
<telerik:RadTreeListView.ChildTableDefinitions>
<telerik:TreeListViewTableDefinition ItemsSource=
"{Binding Children}"
>
<telerik:TreeListViewTableDefinition.ChildTableDefinitions>
<telerik:TreeListViewTableDefinition ItemsSource=
"{Binding Children}"
>
<telerik:TreeListViewTableDefinition ItemsSource=
"{Binding Functions}"
/>
</telerik:TreeListViewTableDefinition>
</telerik:TreeListViewTableDefinition.ChildTableDefinitions>
</telerik:TreeListViewTableDefinition>
</telerik:RadTreeListView.ChildTableDefinitions>
<telerik:RadTreeListView.Columns>
<telerik:GridViewDataColumn DataMemberBinding=
"{Binding Name}"
Header=
"NAME"
>
</telerik:GridViewDataColumn>
</telerik:RadTreeListView.Columns>
</telerik:RadTreeListView>
// 3) In the VM there is nothing special, this is how I populate the nodes:
private
void
InitNodes()
{
SourceDirectoryItem root =
new
SourceDirectoryItem() { Name =
"c:\\"
, Path = Name };
SourceDirectoryItem firstLevel =
new
SourceDirectoryItem() { Name =
"c:\\folder1"
, Path = Name };
SourceDirectoryItem secondLevel01 =
new
SourceDirectoryItem() { Name =
"c:\\folder1\\temp"
, Path = Name };
SourceDirectoryItem secondLevel02 =
new
SourceDirectoryItem() { Name =
"c:\\folder1\\programfiles"
, Path = Name };
firstLevel.Children.Add(secondLevel01);
firstLevel.Children.Add(secondLevel02);
root.Children.Add(firstLevel);
SourceFileItem sf =
new
SourceFileItem();
sf.Name =
"foo.cs"
;
sf.Path =
"c:\\temp"
;
sf.Functions.Add(
new
FunctionItem() { Name =
"Method001"
});
sf.Functions.Add(
new
FunctionItem() { Name =
"Method002"
});
sf.Functions.Add(
new
FunctionItem() { Name =
"Method003"
});
secondLevel01.Children.Add(sf);
SourceFileItem sf1 =
new
SourceFileItem();
sf1.Name =
"bar.cs"
;
sf1.Path =
"c:\\programfiles"
;
sf1.Functions.Add(
new
FunctionItem() { Name =
"AnotherMethod"
});
secondLevel02.Children.Add(sf1);
this
.Nodes.Add(root);
}
private
ObservableCollection<NodeItem> nodes;
public
ObservableCollection<NodeItem> Nodes
{
get
{
return
this
.nodes;
}
set
{
this
.nodes = value;
this
.OnPropertyChanged(
"Nodes"
);
}
}
So my issue is that if I leave the binding for Functions in the XAML I get what you can see in pic 1 (issue.jpg) the third level directory entries are not expandable; if I remove that binding then I get the hierarchy working, of course up until the source file level (no_functions_binding.jpg).
Any idea what could be going on?
Thanks,
Jose