--- layout: post status: publish published: true title: Expanding a treeview to a specific node in WPF wordpress_id: 251 wordpress_url: http://pro.grammatic.org/post-expanding-a-treeview-to-a-specific-node-in-wpf-51.aspx date: !binary |- MjAwOC0wNy0zMCAxMzo0MDo1NSArMDIwMA== date_gmt: !binary |- MjAwOC0wNy0zMCAxMzo0MDo1NSArMDIwMA== categories: - Technology - .NET tags: - C# - WPF comments: [] ---
I've been exploring the dark alleyways of the Windows Presentation Foundation this week and found no way in my trawlings of the net to expand a treeview to a specific node.
No FindNode, no ExpandTo or ExpandAll. Great.
Anyway, here's the solution I came up with. It relies upon a binding the Tag property to the text you are searching for, but that could obviously be changed.
{% highlight csharp %} ///