I need to increment the value of some labels without changing the value of the binding context.
I know I could just create a new variable in my MVVM which is the incremented version of my original value but is there an easy and fast way to do the same thing in XAML only (since I would need to change this projectwide and only need this for frontend)?
Does something like this exist?
<Label>
<Label.Text>
<MultiBinding StringFormat="INCREMENT BINDING BY 1">
<Binding Path="MyValue">
</MultiBinding>
</Label.Text>
</Label>
^Pseudo code which I have in my mind
CodePudding user response:
The easiest way to increment the property myValue
in label.text is to create a new property in MVVM
myValuePlus1{ get { return myValue 1; }}
and use myValuePlus1
as binding source instead of myValue
.