Windows Vista Beta | WinVistaBeta.com - Message | How does a MarkupExtension get to the VisualTree?

July 05, 2008  
Subject: How does a MarkupExtension get to the VisualTree?
Group: microsoft.public.windows.developer.winfx.avalon
Date: 1/18/2008 11:48:01 AM
From: =?Utf-8?B?dGJydW1tZWw=?= [Email Address Protection]

Does anyone know how markup extensions like RelativeSource get access to the
visual tree in their ProvideValue implementations?

I want to write a markup extension that walks the tree upward until it finds
an element with a specified Name but I don't see how I can get to the tree or
even the element the markup extension is being invoked on (which is inside a
template).

I've got a scenario where I need to bind to an ancestor just like the
RelativeSource markup extension allows but I can't do it based on the Type of
the ancestor, I need to do it based on the Name of the ancestor. This is
because the item binding is in a template that is hosted in one of several
different parent templates -- and they each will have an element with the
proper Name but the types differ.



Back