Adding a value to a binding in code behind
-
Friday, May 29, 2009 9:50 AMHi,
I would like to add a given value (kind of an offset) to a multibinding I have.. This has to be done in code behind..
How should I do this?
Can I use another binding in the multibinding (but to a fixed value rather than a binding property)??
Do you have another idea?
thanks in advance...
All Replies
-
Friday, May 29, 2009 12:17 PM
If it's a fixed value, you can use the ConverterParameter property of your multibinding to pass your offset:
<Multibinding Converter="{StaticResource MyConverter}" ConverterParameter="10">
The property will end up in the parameter argument of your Convert and ConvertBack methods in your IMultiValueConverter- Marked As Answer by RuiLopes Friday, May 29, 2009 3:05 PM
-
Friday, May 29, 2009 1:56 PM
If it's a dynamic value, you can make a dependency property in the codebehind, and add a binding to that in your multibinding. Every time you update that property (your offset in this case) the multibinding converter will be hit and update appropriately.- Marked As Answer by RuiLopes Friday, May 29, 2009 3:05 PM

