WPF: how to use 2 converters in 1 binding?

binding, converters, wpf

Solution

To answer my own question again: I have been using this solution for years now:

Piping Value Converters in WPF - CodeProject

It makes a new converter of 2 existing converters, calling the first one first, and then the second one etc etc.

I'm pretty pleased with this solution.

Problem

I have a control that I want to show/hide, depending on the value of a boolean. I have a `NegatedBooleanConverter` (switches true to false and vice versa) and I need to run this converter first. I have a `BooleanToVisibilityConverter` and I need to run this converter after the `NegatedBoolConverter`. How can I fix this problem? I want to do this in XAML. edit: this is a possible solution. That doesn't seem to work. It first converts the value with the separate converters and then does something with the converted values. What I need is: - Convert the value with the first converter (this gives convertedValue). - Convert convertedValue with the second converter and it's this result that I need.

Original source

Related problems