Question

I have 2 different ProgressBars with 2 different custom styles. In each of them, Color of the ProgressBar is Calculated based on Maximum and Value (with 2 different formulas).

I see that the type of the ConverterParameter in a converter is String. Now I'm wondering should I write 2 different MultiValueConverters for each of them, or write a single MultiValueConverter with a Parameter and let the Parameter decide which formula should be executed.

These 2 ProgressBars are probably the bottle-neck of my MVVM's View, so I need to know which one is better in performance?

Was it helpful?

Solution

Write one converter - it makes no sense to have multiple converters for the same purpose.

Indicate which formula you want to use by using an enumeration - the value can be explicitly mentioned in the XAML.

If you want to bind external values in to your converter it will need to derive from DependencyObject and the properties will have to be dependency properties.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top