Why does MultiBinding with a Converter not work within a ToolTip?

孤街醉人 提交于 2019-12-04 12:47:07
Andre Luus

Try setting Mode="OneWay" on your binding.

Also, have you checked this problem and solution: http://social.msdn.microsoft.com/Forums/en-IE/wpf/thread/15ada9c7-f781-42c5-be43-d07eb1f90ed4

The reason of this error is the tooltips have not been loaded, so DependencyProperty.GetValue returns DependencyProperty.UnsetValue. You should add some code to test that is value is Dependency.UnsetValue. The following code shows how to do this.

public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
{
    if (values[0] == DependencyProperty.UnsetValue || values[1] == DependencyProperty.UnsetValue) 
        return "";
    [...]
}

Try this:

<ToolTipService.ToolTip>
    <StackPanel>
        <TextBlock>
            <TextBlock.Text>
                <MultiBinding Converter="{StaticResource multiValueConverter}">
                    <MultiBinding.Bindings>
                        <BindingCollection>
                            <Binding Path="Amt"/>
                            <Binding Path="Currency"/>
                        </BindingCollection>
                    </MultiBinding.Bindings>
                </MultiBinding>
            </TextBlock.Text>
        </TextBlock>        
    </StackPanel>
</ToolTipService.ToolTip>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!