Search code examples
c#wpfmultibindingstring-formattingimultivalueconverter

Is it possible to use both a converter AND a StringFormat in WPF MultiBinding?


I am using the following MultiBinding. The converter outputs an int and the expected output of the MultiBinding is something like "SomeText|123". The Bindings and converter work fine, but the StringFormat doesn't seem to be applied - I just get the int value that the converter outputs. Is it possible to apply the StringFormat to the IMultiValueConverter's output?

<MultiBinding Converter="{StaticResource MyConverter}"
              StringFormat="SomeText|{}{0}">
    <Binding />
    <Binding Path="SomePath" />
</MultiBinding>

Thanks!


Solution

  • The issue was that I was binding to a property of type object. by changing this to a string property the stringformat was used as expected.