MultiBinding with custom converter
Posted: 27 Apr 2022, 10:56
Hello, I always get an error on startup if I use my own converters:
But it works fine at runtime.
This xaml has an error:
But this does not have an error:
How can I fix this errors?
Code: Select all
MultiBinding converter failed to convert source valuesThis xaml has an error:
Code: Select all
<UserControl.Resources>
<ResourceDictionary>
<converters:MultiplyConverter x:Key="multiplyConverter" />
</ResourceDictionary>
</UserControl.Resources>
<StackPanel>
<Rectangle
x:Name="Rectangle2"
Width="100"
Height="100"
Fill="#FF991919" />
<Rectangle
x:Name="Rectangle3"
Width="2"
Height="100"
Fill="#FF991919" />
<TextBlock Width="100" Height="20">
<TextBlock.Text>
<MultiBinding Converter="{StaticResource multiplyConverter}">
<Binding ElementName="Rectangle2" Path="Width" />
<Binding ElementName="Rectangle3" Path="Width" />
</MultiBinding>
</TextBlock.Text>
</TextBlock>
</StackPanel>
Code: Select all
<StackPanel>
<Rectangle
x:Name="Rectangle2"
Width="100"
Height="100"
Fill="#FF991919" />
<Rectangle
x:Name="Rectangle3"
Width="2"
Height="100"
Fill="#FF991919" />
<TextBlock Width="100" Height="20">
<TextBlock.Text>
<MultiBinding StringFormat="{}{0} x {1}">
<Binding ElementName="Rectangle2" Path="Width" />
<Binding ElementName="Rectangle3" Path="Width" />
</MultiBinding>
</TextBlock.Text>
</TextBlock>
</StackPanel>