Mina Wissa
Mina Wissa

Reputation: 10971

Windows Store Apps: localized control style through resw files?

I have a Windows Store App that supports English and Arabic Languages.

In a page I have a localiezed Text block like this:

<TextBlock x:Uid="TxtTitle" Style="{StaticResource TxtStyle}" />

and I have two resw files with the following structire:

in each resw file I have an entry with the key TxtTitle.Text that has the localized text of the TextBlock.

Now I want to localize the style of text block, so I added the following entries to the resw files:

then removed the Style attribute from the TextBlock in my page.

The problem is that the application crashes, what can be wrong here ?

Upvotes: 0

Views: 424

Answers (2)

ChristiaanV
ChristiaanV

Reputation: 5541

I did some testing and I think this will solve your issue:

In the Style, give your Setter and x:Uid and reference that one in your resource file with [X:uid].Value

<Style x:Key="x" TargetType="TextBlock">
    <Setter x:Uid="blabla" Property="Text" Value="LeftToRight" />
</Style>

I have value in my resource file blabla.Value = "some value"

Upvotes: 1

crea7or
crea7or

Reputation: 4490

Use this solution to put localization into Portable Class Library. In the most cases it will allow you to avoid such problems with localization in resources.

Upvotes: 0

Related Questions