Accessing "current class" from WPF custom MarkupExtension

Posted by chaiguy on Stack Overflow See other posts from Stack Overflow or by chaiguy
Published on 2010-06-15T17:21:13Z Indexed on 2010/06/15 17:42 UTC
Read the original article Hit count: 200

Filed under:
|
|
|

I'm attempting to write a custom MarkupExtension to make my life easier by giving me a better way to specify bindings in XAML. However I would like to know if there is any way I can access the object that represents the file the MarkupExtension is used in.

In other words, suppose I have a UserControl that defines a particular rendition of a data model of my program. This control has lots of visual stuff like grids, borders and general layout. If I use my MarkupExtension on a particular property of some element in this UserControl, I want to access the instance of the UserControl, without knowing what type it is (I plan on using reflection).

Is this at all possible?

© Stack Overflow or respective owner

Related posts about c#

Related posts about wpf