locked
Would it be nice to be able to do basic math in xaml? RRS feed

  • Question

  • Almost every time I make a control template I find {TemplateBinding} to be insufficient. I always want to define some property, usually width, height, padding or margin in terms of another or the same property on the control template (hence {TemplateBinding} but divided by 2, or -10, or +2. I've searched low and high, and can't find any such functionality. It seems to me to be something very simple to implement and something that is universally useful without violating the MVC pattern at all. Of course one way of doing this (and something that definately should happen!) is being able to build custom markup extensions (ala WPF) which, as far as I can tell from repeated searching, is not yet possible in Silverlight. I'm interested to see people's comments on this. -Dan
    Monday, May 5, 2008 12:11 PM

Answers

  • Hi:

      In WPF we can use IValueConverter in TemplateBinding to achieve this requirement. However it's not supported in current Silverlight. We're now working on this. It may be supported in later version.

    Regards

    Wednesday, May 7, 2008 3:59 AM