Automatic inversion of binding expressions
masterCalcBinding can automatically create two-way bindings by mathematically inverting a one-way expression. If you define a binding where a UI property depends on a ViewModel property via a formula, CalcBinding calculates the inverse formula to update the ViewModel when the UI property changes.
Example:
If TextBox.Text depends on ViewModel.A via Math.Sin(A*2)-5, you can write:
<TextBox Text = "{c:Binding 'Math.Sin(A*2)-5'}">CalcBinding will automatically use the inverse expression A = Math.Asin(TextBox.Text + 5) / 2 for the ConvertBack operation.
Restrictions for automatic inversion:
- The binding must include exactly one property path (static or non-static) and only one entry of it.
- The expression can only use the following operators and methods:
"+","- (binary)","*","/","Math.Sin","Math.Cos","Math.Tan","Math.Asin","Math.Acos","Math.Atan","Math.Pow","Math.Log","!","- (unary)".