Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6182621
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T01:13:49+00:00 2026-05-24T01:13:49+00:00

How do I set different localized strings in different visual states in WP7 using

  • 0

How do I set different localized strings in different visual states in WP7 using Blend without any code behind?

I can set different non-localized strings in different visual states (although it flickers). That works, but how about localized strings?

If I change the string using data binding in Blend, Blend just overrides the data binding in Base state and not the actual state where I’m recording.

EDIT:

This is how I localize my strings:

I have a resources file named AppPresources.resx. Then I would do this in code:

    // setting localized button title
    mainButton.Content = AppResources.MainButtonText;

Then I have a GlobalViewModelLocator from MVVM Light Toolkit with the following Property for Databinding.

    private static AppResources _localizedStrings;
    public AppResources LocalizedStrings
    {
        get
        {
            if (_localizedStrings == null)
            {
                _localizedStrings = new AppResources();
            }
            return _localizedStrings;
        }
    }

And in xaml file:

<Button x:Name="mainButton" Content="{Binding LocalizedStrings.MainButtonText, Mode=OneWay, Source={StaticResource Locator}}" ... />
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T01:13:50+00:00Added an answer on May 24, 2026 at 1:13 am

    What you need to do, is very close to what you’re already doing. First, define a class named Resources.cs with following content

    public class Resources
    {
        private static AppResources resources = new AppResources();
    
        public AppResources LocalizedStrings
        {
            get
            {
                return resources;
            }
        }
    }
    

    This allows us to create a instance of your Resource File in XAML. To do this, open App.xaml and add following

    <Application.Resources>
        <local:Resources x:Key="Resources" />
    </Application.Resources>
    

    Now when you need to do bindings in your XAML, you do it like this:

    <Button Content="{Binding LocalizedStrings.MainButtonText,
                              Source={StaticResource Resources}}" />
    

    What you’ll notice is that it doesn’t work in Blend, yet. To make it work in Expression Blend,
    add the following file: DesignTimeResources.xaml in the Properties Folder, and add following content

    <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                        xmlns:local="clr-namespace:YourNameSpace">
        <local:Resources x:Key="Resources" />
    </ResourceDictionary>
    

    Now, you press F6 in Visual Studio to recompile, and voila, your localized strings are available in Expression Blend!

    A real-world example from one of my projects:

    • AppResources.cs
    • DesignTimeResources.xaml
    • App.xaml
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible, using only CSS, to set different styles on odd and even
My current project is using a metadata file to set properties without having to
With different resource files (*.resx), how can I retrieve localized values by giving explicit
Is there any way to set different errors according with logic in MVC 3.0
Browsers usually set different default styles for elements. Users can also override the defaults
Is there a way to set a different value for service startup timeout per
Is it possible to have a different set of dependencies in a maven pom.xml
When programming in C++ against the browser's DOM each engine has a different set
I have set up transactional replication between two SQL Servers on different ends of
I'd like to set a cookie via Django with that has several different values

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.