This question is locked. New answers and comments are not allowed.
(Sorry, I meant to put this in the Treeview Forum) :(
I've spent several hours this morning trying to get this to work, but I'm at a loss. I'm sure I'm doing something stupid. Can someone please clue me in?
I have an object called Procedures. (Not sure if I even need it, but...). Procedures has a list of Categories. Each Category has a Name and a list of Items (ProcedureData). Each ProcedureData has a Name and ID. This is probably simpler than it sounds.
All I want to do is Bind this to a TreeView control. I want to display the Categories as the root nodes, then the list of ProcedureNames as their child nodes. This is what I have so far.
I build the Procedures object in code-behind, populate it, and set it as the ProcedureTree.DataContext.
The problem is, I get nothing. Nada. An empty tree. I did inspect the object(s) in the debugger, and I see all the items in the object that I expect to see.
What am I doing wrong?
I've spent several hours this morning trying to get this to work, but I'm at a loss. I'm sure I'm doing something stupid. Can someone please clue me in?
I have an object called Procedures. (Not sure if I even need it, but...). Procedures has a list of Categories. Each Category has a Name and a list of Items (ProcedureData). Each ProcedureData has a Name and ID. This is probably simpler than it sounds.
| class ProcedureData |
| { |
| public string ProcedureName; |
| public int ProcedureID; |
| } |
| class Category |
| { |
| public string Name; |
| public List<ProcedureData> Items; |
| public Category(string name) |
| { |
| Items = new List<ProcedureData>(); |
| Name = name; |
| } |
| } |
| class Procedures |
| { |
| public List<Category> Categories; |
| public Procedures() |
| { |
| Categories = new List<Category>(); |
| } |
| } |
All I want to do is Bind this to a TreeView control. I want to display the Categories as the root nodes, then the list of ProcedureNames as their child nodes. This is what I have so far.
| <telerik:HierarchicalDataTemplate x:Key="Cats" ItemsSource="{Binding Items}"> |
| <TextBlock Text="{Binding ProcedureName}" /> |
| </telerik:HierarchicalDataTemplate> |
| <telerik:HierarchicalDataTemplate x:Key="Procedures" ItemsSource="{Binding Categories}" ItemTemplate="{StaticResource Cats}"> |
| <TextBlock Text="{Binding Name}" /> |
| </telerik:HierarchicalDataTemplate> |
| <telerikNavigation:RadTreeView x:Name="ProcedureTree" IsRootLinesEnabled="True" IsLineEnabled="True" ItemTemplate="{StaticResource Procedures}" /> |
I build the Procedures object in code-behind, populate it, and set it as the ProcedureTree.DataContext.
The problem is, I get nothing. Nada. An empty tree. I did inspect the object(s) in the debugger, and I see all the items in the object that I expect to see.
What am I doing wrong?