How can I pass a constant value for 1 binding in multi-binding?

Or, combining the two answers above:

Define the namespace sys at the document head:

xmlns:sys="clr-namespace:System;assembly=mscorlib"

and then:

<MultiBinding Converter="{StaticResource ScalingConverter}">
    <Binding>
        <Binding.Source>
            <sys:Double>0.5</sys:Double>
        </Binding.Source>
    </Binding>
    <Binding ElementName="TC" Path="ActualWidth" />
</MultiBinding>

Which provides the right type without the Resources kludge.


If your value is simply a string, you can specify it as a constant in the Source property of a binding. If it is any other primitive data type, you need to define a static resource and reference this.

Define the sys namespace in the root of the XAML to point to System in mscorlib, and the following should work:

<TextBlock>
  <TextBlock.Resources>
    <sys:Int32 x:Key="fixedValue">123</sys:Int32>
  </TextBlock.Resources>
  <TextBlock.Text>
    <MultiBinding Converter="{StaticResource myConverter}">
      <Binding Path="myFirst.Value" />
      <Binding Source="{StaticResource fixedValue}" />
    </MultiBinding>
  </TextBlock.Text>
</TextBlock>