【发布时间】:2013-11-06 22:32:09
【问题描述】:
WPF 中有一个Multibinding 的概念,如果我们想绑定一些依赖多个值的 UI 控件,例如在 this 中的一个,这非常有用。
我正在尝试对ProgressBar 做同样的事情,就像我使用ProgressBar 来显示用户使用了多少存储空间,它取决于两个属性。
- 已用存储
- 总存储量
搜索后,我找不到将ProgressBar 的Value 属性与多个属性和自定义转换器绑定的方法。
类似的东西(只是一个概念)
<ProgressBar Width="172" Height="16" >
<ProgressBar.Value>
<MultiBinding Converter="{StaticResource myConverter}">
<Binding Path="UsedStorage" RelativeSource="{RelativeSource AncestorType={x:Type Window}}"/>
<Binding Path="TotalStorage" RelativeSource="{RelativeSource AncestorType={x:Type Window}}"/>
</MultiBinding>
</ProgressBar.Value>
</ProgressBar>
但问题是在ProgressBar.Value 下没有像MultiBinding 这样的东西。那么问题来了,
有没有办法MultiBindProgressBarValue?
【问题讨论】:
标签: c# .net wpf xaml data-binding