如何做到在XAML计算,而绑定? [英] How to do calculation in xaml while binding?

查看:139
本文介绍了如何做到在XAML计算,而绑定?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以绑定一个标签,一个滑块,如下所示:

I can bind a label to a slider as shown below:

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

如何绑定另一个标签用的,比如显示值,滑块的价值的30%,同样的滑盖的?我该怎么做在XAML,而不是在我的code计算?谢谢你。

How do I bind another label to the same slider with display value of, say, 30% of the value of slider? How do I do the calculation in xaml and not in my code? Thanks.

推荐答案

您不能做在XAML计算,可以适用,但有些<一个href=\"http://msdn.microsoft.com/en-us/library/system.windows.data.binding.converter.aspx\">converter它会为你。

You cannot do the calculation in XAML, you could however apply some converter which does it for you.

此问题可能是相关的:<一href=\"http://stackoverflow.com/questions/4969600/how-do-you-change-a-bound-value-reverse-it-multiply-it-subtract-from-it-or-ad\">How你更改绑定值,扭转它,繁衍,从失败中加上或减去呢?

This question might be relevant: How do you change a bound value, reverse it, multiply it, subtract from it or add to it?

这篇关于如何做到在XAML计算,而绑定?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆