Using String from Dictionary in ConverterParameter

I am trying to use String from a dictionary:

 <?xml version="1.0" encoding="utf-8" ?> <Dictionary EnglishName="English" CultureName="English" Culture="en-US"> ... <Value Id="ButtonSuppressFieldInformation" ToolTip="Remove field" Name="Remove field number "/> ... </Dictionary> 

In this ConverterParamter , to enable multi-language support:

 <Button> ... <AutomationProperties.Name> <MultiBinding Converter="{StaticResource IndexedForAutomationId}" ConverterParameter="{loc:Translate Uid=ButtonSuppressFieldInformation, Default=Delete field}"> <Binding RelativeSource="{RelativeSource Self}" /> <Binding ElementName="MyContactDirectoryView" Path="ListConditionToSearch" /> </MultiBinding > </AutomationProperties.Name> </Button> 

But the only thing shown is the number ( IndexedForAutomationId ), the String not displayed.

Using String instead of "{loc:Translate Uid=ButtonSuppressFieldInformation, Default=Delete field}" works:

 <MultiBinding Converter="{StaticResource IndexedForAutomationId}" ConverterParameter="Delete field"> 

Displays Delete field 0 .

How can loc:Translate be used as ConverterParameter?

+4
source share
1 answer

This problem can be caused by many things, and another code will be useful here. However, I would start from the breakpoint using the Convert() method of the IndexedForAutomationId converter 1) to check whether you get the values ​​that you expect from internal bindings, and 2) check whether the converter itself returns the correct string from the dictionary.

Please check out these guidelines for debugging WPF bindings .

+1
source

All Articles