I am relatively new to WPF C#, and I'm trying to set the visibility of a tree node. The nodes are created at runtime so there is no code in XAML for each node. Am I able to do everything in C# without binding? I started by filling the tree with everything from a list, and based on other conditions, I hide certain nodes from the user so there is less for them to look at since it is a pretty extensive list.
foreach (TreeViewItem sheetItem in sheetTreeView.Items)
{
if (sheet.Id.ToString() == sheetItem.Tag.ToString())
{
sheetItem.Visibility.Hidden; // Referencing Instance
}
}
Since I'm referencing an instance of an item, it is asking that I qualify it with a type name instead.
What does this mean, and can I still set the visibility of a referenced item somehow?