[WPF] Having trouble binding list to TreeViewItem

I have been trying to bind a list of classes to a TreeViewItem and have been having a bit of trouble. I have a list (tempList = new List<CQSystems>();) filled with the following class:

 public class CQSystems { public int DBID { get; set; } public string sysName { get; set; } public string systemState { get; set; } public string serviceArea { get; set; } } 

and have been trying to bind it as follows:

<TreeView> <TreeViewItem x:Name="treeViewAll" Header="All Systems" AllowDrop="True" ItemsSource="{Binding sysName}" > <TextBlock Text="{Binding sysName}"> </TextBlock> </TreeViewItem> </TreeView> 

I set my DataContext to the class name, but I am not getting anything. Can anyone point out what i'm doing wrong?

by Fun_Hat via /r/csharp

Leave a Reply