in Uncategorized

Avalon MarkupExtension To Bind Directly To Another Element Instance In The Logical Tree

This was a pretty interesting experiment. Ian Griffiths made a post to the Avalon NG asking why it wasn’t possible to just put the ID of a node into the Target property of a Label in XAML. The reason is because it’s a property that expects another FrameworkElement instance. So I created a custom MarkupExtension to provide the behavior at deserialization time.

Click here to read the thread and click here to get the source code for my custom MarkupExtension which works, but has an unfortunate restriction right now which you’ll learn about at the end of my reply to Ian’s original post. Hopefully I’ll find or get a solution from Microsoft and, when I do, I will post an updated working version.

Leave a Reply for froz Cancel Reply

Leave a comment

Comment

  1. Actually you don’t need it these days. Just use Binding with the ElementName property. Something like:

    {Binding ElementName=MyElement, Path=SomePropertyName}

    HTH,
    Drew

  • Related Content by Tag