0
votes

I am developing a custom control for WinRT. I have a property with type CultureInfo. When I try to set this property in XAML, it shows following error.(But it shows possible values in intellisense.)

Cannot assign text value 'af-ZA' into property 'Culture' of type 'CultureInfo'

What is the correct way to set this property from XAML?

Thanks,

1

1 Answers

2
votes

It sounds like the Culture property of the unnamed control takes a CultureInfo object rather than a culture name. Create a CultureInfo object and assign it to the property, perhaps in the code behind.

It appears that CultureInfoConverter class may not be available in WinRT. It is not in the WinRT System.ComponentModel namespace. Indeed, the TypeConverter class does not exist(see WinRT Replacement for System.ComponentModel.TypeConverter) but IValueConverter does so you could write your own. See How to inject a Converter in XAML for information using a converter.