Suppose I want to show list of objects where each object should have a name and a suitable image (for example MenuItems with Icons, or buttons with text and image).
All
There's a bug in custom MarkupExtensions that doesn't allow you to use them in an attribute like that.
Workaround 1: Declare the attribute as an element, like so:
Workaround 2: If you precompile the MarkupExtension by putting it in another assembly and referencing it, then it works again. This might be why you're seeing it work in the main window, but not in your DataTemplate.