-1

first off, I'm aware of the general solution to the WPF culture problem: Setting Culture (en-IN) Globally in WPF App

My question is as follows: I have an IValueConverter for decimal numbers and dates and for them I get the correct CultureInfo in the interface call

object Convert(object value, Type targetType, object parameter, CultureInfo culture)

However I also want to convert an Enum value into a UI text. But for this I need CurrentUICulture and not CurrentCulture. Of course I could use Thread.CurrentThread.CurrentUICulture or CultureInfo.CurrentUICulture directly and just ignore the CultureInfo.

But that doesn't feel like proper usage of the interface.

Dee J. Doena
  • 1,631
  • 3
  • 16
  • 26

1 Answers1

1

But that doesn't feel like proper usage of the interface.

It is. An implementation of the IValueConverter interface is supposed to convert values and hence doesn't care about any UICulture.

So getting the CurrentUICulture from a source external to the converter is actually a proper use. The CurrentUICulture is not passed to the Convert method.

mm8
  • 163,881
  • 10
  • 57
  • 88