I was helping someone out on this thread in the WPF Forum the other day. Basically the guy wanted to bind a property on a custom ValidationRule to some value in a template’s DataContext. This turned out to be much tricker than it initially appeared. I figured out a way to do it, by designing a technique which allows you to “attach a virtual branch” to the logical tree. I won’t bother describing it in detail here, because I just posted a CodeProject article about it: http://www.codeproject.com/useritems/AttachingVirtualBranches.asp
In my opinion, this is the most interesting and useful contribution I’ve ever made to the WPF community. I’m looking forward to seeing how people use this pattern in their applications.


May 6, 2007 at 6:19 pm
Pushing values into resources
Josh Smith just posted a new pattern for “Virtual Branches” in WPF – allowing bindings on elements which are not in the logical tree. It works by rerouting the DataContext through StaticResource references. It’s undoubtedly interesting, but I’m le…