Freigeben über


How to: Make Non-String Values Localizable

Microsoft Silverlight will reach end of support after October 2021. Learn more.

In some cases, your XAML code may contain a non-string value. When you localize your Silverlight-based application, you can make the non-string value localizable by performing the following steps. This procedure assumes that you have already created the necessary resource files and created the class that returns the resources. (For more information, see Localizing Silverlight-based Applications.)

To make a non-string value localizable

  1. Store a string representation of the non-string value that you want to make localizable in the resource file.

  2. Use a value converter (an System.Windows.Data.IValueConverter implementation) to convert the string to the appropriate type. (See How to: Combine Localizable Strings at Run Time and How to: Make Rich Text Strings Localizable for examples that provide IValueConverter implementations.)