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

  • SEARCH
  • Home
  • 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 7573053
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T16:04:55+00:00 2026-05-30T16:04:55+00:00

I have a control that we could identify as similar to ListBox control. Each

  • 0

I have a control that we could identify as similar to ListBox control. Each item is represented with one element (example TextBlock). What i would like is to change the layout of this item, so that it contains two TextBlocks. So I create a ControlTemplate, put a Border Grid, TwoTextBlocks, and all is well. Now the problem:

I need to be able to localize the text in the item, and I did this normally like this:

<... Text="{Binding Strings.SomeString, Source={StaticResource ApplicationResources}}" />

Now I need to be able to do the same with both TextBlocks. So i thought I need to create a custom type that this item will bind to, and expose two propertiws: Title and Description. If I expose this properties as string type, everything works ok, but I am loosing markup binding that I used previously. How to achieve the same with two properties? The result should be like:

<... Title="{Binding Strings.SomeString, Source={StaticResource ApplicationResources}}", Description="{Binding Strings.AnotherString, Source={StaticResource ApplicationResources}}" />

I was able to make Localization work with ResourcemManager class, but it gets even complicated in order to provide localization to be applied dynamically at runtime.

So, what do I need to do to be able to use above code? Then I just need to implement INotifyPropertyChanged on ApplicationResource and all is set.

  • 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-30T16:04:56+00:00Added an answer on May 30, 2026 at 4:04 pm

    Great!

    I’m going to do the same thing you did here. Yeah, I have a solution but I’m not sure if it works till now.

    First, we need a LocalizationManager which holds a dictionary.

    For example, if you need to localize a user account window, just do this

    <TextBlock Text="something, UsernameKey">
    

    And the localizationManager will map UsernameKey to “Username” or other language

    Second, a xaml extension which find the value of the key from LocalizationManager.

    I wonder if this custom extension could derived from Binding extension, if so, this’ll be very easy, just create a Binding Object to the target. If not, I think holding a WEAK reference to the UIElement by xaml extension to dynamic update the text is proper.

    This solution is simple but not generic. There’re some language read from right to left. It asks the application to show content from right to left.

    So, I have another generic solution but more complex.

    Instead of xaml extension, we use an attach dependency property.

    Do it like this:

    <TextBlock LocalizationManager.LocalizationKey="UsernameKey" />
    

    So, the problem now is how to set “Text” property by LocalizationManager?

    We use adapters, LocalizationManager will search proper adapter for type “TextBlock”

    So, when the application is booting, we register some adapters to LocalizationManager:

    LocalizationManager.Current.RegisterAdapter<TextBlock>(new TextBlockAdapter())
    

    This solution is more generic, it supports any kind of control if you provide adapter, but as you see, this solution needs more work and much more complex than the former one.

    I hope these design solutions could help you~

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How would I go about the following... I have a control that can be
I have a control that, upon postback, saves form results back to the database.
I have a control that is created like so: public partial class MYControl :
I have a control that is basically functioning as a client-side timer countdown control.
I have a control that I'm writing where I want to turn off .NET's
I have a control that look something like this: <asp:DetailsView ID=dvUsers runat=server DataSourceID=odsData DataKeyNames=Id>
I have a control that has a Filter property that expects a function that
I have a control that goes inactive under some conditions in my iPhone app.
I have a control that has a byte array in it. Every now and
I have a control that handles commenting. In this control, I have set a

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.