4

I would like to have a MarkupExtension that can be initiated with just one value, much like Binding:

<TextBox Text="{Binding MyPath}"/> instead of <TextBox Text="{Binding Path=MyPath}">

In WPF this is done with the ConstructorArgumentAttribute, but this doesn't exist in Silverlight.
I checked for attributes on the Path property of Binding but have'nt found any attributes applied to it.

Any ideas?

Shimmy Weitzhandler
  • 101,809
  • 122
  • 424
  • 632
  • Reading into the documentation that I've found so far, I don't believe this is possible. – Jeff Yates May 10 '11 at 21:01
  • @Jeff So how come the SL team did it!? I won't fall asleep until I get to know it :) I know it's impossible out the box, they would've surely done this att. I'm looking for a workaround, or at least an explanation of how they're doing it. – Shimmy Weitzhandler May 10 '11 at 21:18
  • I suspect they have some private/internal code that allows them to achieve this on known types. However, we only get `IMarkupExtension` to play with and that on its own doesn't seem to support it. As they write the parser, they can easily look for known extensions like `Binding` and give special case handling. – Jeff Yates May 10 '11 at 21:19
  • But I think it's too many of them (`Binding`, `TemplateBinding`, `StaticResource`, `RelativeSource` and many others), it doesn't really make sense that they made a list of known types and addressed the parameters. But I would love to hear about any idea how they did it if you manage to trap it down with [Reflector](http://reflector.red-gate.com). – Shimmy Weitzhandler May 10 '11 at 22:02

1 Answers1

2

For now I realize that it's not yet implemented.

So if you think this feature is compelling, please go ahead and vote for this feature here.

Hope this answer to be updated as soon as I have any piece of news (hope this to happen asap...).

Shimmy Weitzhandler
  • 101,809
  • 122
  • 424
  • 632