Firoso
Firoso

Reputation: 6685

How to manage localized string and image (icon) resources in a WPF application?

We are currently trying the sat assembly approach to localization of resources, but when we do this, accessing the Properties.Resources static class doesn't seem to work from XAML. Any advice or better methods for handling localization in WPF applications?

Upvotes: 1

Views: 855

Answers (1)

Sogger
Sogger

Reputation: 16132

Delay's blog had a sample a while back about localization with wpf: This quote might help:

For readers who want a brief overview of how to use RESX-resources in WPF, here you go:

Set the Access Modifier to "Public" in the RESX designer so the auto-generated resource property accessors will be accessible to the WPF data-binding system.

Create an instance of the auto-generated RESX class (typically named "Resources") as a WPF-accessible resource:

<Window.Resources>
    <properties:Resources x:Key="Resources" xmlns:properties="clr namespace:PseudoLocalizerWPF.Properties"/>
</Window.Resources>

Create a Binding that references the relevant properties of that resource wherever you want to use them:

<TextBlock Text="{Binding Path=AlphabetLower, Source={StaticResource Resources}}"/>

Upvotes: 2

Related Questions