TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Ethan Williams
NA
2
582
How to set visibility of a Tree Node that is created at runtime in C#
Jan 20 2021 6:32 PM
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?
Reply
Answers (
1
)
How to create expandable textbox in wpf
Virtualization in WPF datagrid