绑定时如何在xaml中进行计算?

时间:2012-01-15 23:44:34

标签: wpf xaml binding

我可以将标签绑定到滑块,如下所示:

<Label Name="lblTest" Content="{Binding ElementName=slider1, Path=Value}"/>

如何将另一个标签绑定到同一个滑块,显示值为,例如,滑块值的30%?如何在xaml中进行计算而不是在我的代码中进行计算?感谢。

2 个答案:

答案 0 :(得分:21)

你无法在XAML中进行计算,但是你可以应用一些converter来为你做计算。

这个问题可能有用:How do you change a bound value, reverse it, multiply it, subtract from it or add to it?

答案 1 :(得分:9)

已经有一些项目给Bindigs带来了表达,例如:看到 CalcBindingQuickConverter

相关问题