"how to dynamically add a converter in code-behind" Code Answer


the converter is called after getting at the data through the property path. as there is no "forename" property in row, it does not work (you can see the binding exception in the output window).

i solved it by changing the binding definition to:

    binding bind = new binding();
    bind.mode = bindingmode.oneway;

as you cannot have two-way binding without a path (the exception i got without the second line). having no property path makes sense, on second thought, as we want to bind to the full row object, not to one of its properties.

note: tested with vs 2008 sp1, wpf project.

By lili on January 7 2022

Answers related to “how to dynamically add a converter in code-behind”

Only authorized users can answer the Search term. Please sign in first, or register a free account.