Is it possible to have WPF/SL4 perform operations on a property binded to another control?
Using SilverLight, one can bind the value of a control to a property from a datacontext. That's fine.
It is possible to use StringFormat along with the binding declaration to format the value. Again, that's cool!
However, I can't find a way to have the binding with some operation done to it before it gets displayed. I know I can code an IConverter but I was looking for something purely in XAML if that exists. I could also add a property to the class that returns the data in the correct way, but still what would happen if you don't have the source of the class?
For example, let's say I have this class for my datacontext (properly setup with notification and the like):
public class Info
{
public int SomeValue {...} // Value from 0 to 15
}
I would like to have a binding that would display 45 instead of 15 where the binding would be declared something like {Binding SomeValue, Operation="*3"}
Is there something like this in the .NET world (either from MSof开发者_开发百科t or OpenSource)?
found the link I was talking about.
Still, Charles Petzold also suggest to rather use a ValueConverter, even though some arithmetics is possible in pure XAML
精彩评论