1

There is a concept of Multibinding in WPF, which is really useful if we want to bind some UI Control that depends on multiple values, like in this one.

I am trying to do the same with ProgressBar, like I am using ProgressBar to display how much storage is used by the users and it depends on two properties.

  1. UsedStorage
  2. TotalStorage

After searching, i could not find a way to bind Value property of ProgressBar with multiple properties and custom convertor.

Something like (Just a concept)

<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>

But problem is there is nothing like MultiBinding under ProgressBar.Value. So the question is,

Is there a way to MultiBind ProgressBar Value?

Community
  • 1
  • 1
Mirza Bilal
  • 891
  • 11
  • 34

1 Answers1

3

Even though the Visual Studio intellisense might not show that, it is perfectly valid.

However, Using RelativeSource TemplatedParent only works inside a ControlTemplate. It is unclear to me where are you trying to get your values from.

Federico Berasategui
  • 43,562
  • 11
  • 100
  • 154