views:

23

answers:

1

I have a Silverlight application that needs to display data in both English (feet, pounds etc.) and metric (meters, kilograms etc) units. I would like the user to be able to choose which units of measure he wishes displayed, which would vary by user.

Trying to be a good programmer allowing for proper encapsulation and separation of concerns, this would seem to be a presentation issue and not a data layer issue.

Lets assume I store all the data in the data layer in just one system, metric for the sake of this example.

If my XAML binds to the data layer, and all values are returned in metric units, is it reasonable to use Silverlight converters (value, data and format) to transform the metric units to English?

I can't believe I am the first person with this requirement, so I am looking for other people who have guidance on the best practice for supporting this type of internationalization in Silverlight 4.

A: 

Yes, this is a presentation issue and converters are the way to go (resources don't make sense here).

In your data context, you could have the data to display as well as a property containing the user preference of units. This preference could be given as the Converter parameter, so that the converter knows if conversion is needed or not.

Timores