Brian Var
Brian Var

Reputation: 6227

How to set TextBlock text property to a string resource?

I've been following this tutorial Using String resources (xaml) to set up string resources, in a Windows Universal project. But even though I've set the Uid of the text block to the string resource name, the string contents aren't displayed in the text block during testing the app.

Does anyone know where I might be missing a step in setting up the string resource as the text block text value?

This is the xaml definition for the text block, showing the Uid set to the same name as the name of the string in resources "About":

<TextBlock x:Uid="About"
                   Grid.Row="1"
                   Grid.RowSpan="2"
                   Width="400"
                   Height="300"
                   HorizontalAlignment="Left"
                   VerticalAlignment="Top"
                   Text=""
                   TextWrapping="Wrap" />

This is the res file itself:

res view

And this is the structure of the source tree:

src tree

Upvotes: 3

Views: 902

Answers (1)

Jerin
Jerin

Reputation: 4259

Resources files when accessed using UID are usually of the type Controlname.Property for which you want to bind.

So it should be About.Text not About tested And Workingenter image description here

Upvotes: 2

Related Questions